// return true if we need to send the path to the BMP server
973816
func (r ribout) update(p *table.Path) bool {
	key := p.GetNlri().String() // TODO expose (*Path).getPrefix()
	l := r[key]
	if p.IsWithdraw {
		if len(l) == 0 {
			return false
		}
		n := make([]*table.Path, 0, len(l))
		for _, q := range l {
			if p.GetSource() == q.GetSource() {
				continue
			}
			n = append(n, q)
		}
		if len(n) == 0 {
			delete(r, key)
		} else {
			r[key] = n
		}
		return true
	}

	if len(l) == 0 {
		r[key] = []*table.Path{p}
		return true
	}

	doAppend := true
	for idx, q := range l {
		if p.GetSource() == q.GetSource() {
			// if we have sent the same path, don't send it again
			if p.Equal(q) {
				return false
			}
			l[idx] = p
			doAppend = false
		}
	}
	if doAppend {
		r[key] = append(r[key], p)
	}
	return true
}
716607
func MasterPostReq(path string, req interface{}, resp interface{}) error {
	return masterReq(path, req, resp, false)
}
821679
func pathMatch(requestPath string, r Route) bool {
	// if there is no path, no need to worry about matching (default to "/")
	if r.Path == "" {
		return true
	}
	match := false
	switch r.Path[len(r.Path)-1] {
	case '/':
		// check for parent dir match
		match = strings.HasPrefix(requestPath, r.Path)
	case '*':
		// check for prefix match
		match = strings.HasPrefix(requestPath, r.Path[:len(r.Path)-1])
	default:
		// check for exact match or exact match + "/"
		match = (r.Path == requestPath) || strings.HasPrefix(requestPath, r.Path+"/")
	}
	lumber.Trace("[NANOBOX-ROUTER] Path match: '%t'", match)
	return match
}
751387
func (s *DomainSnapshot) IsCurrent(flags uint32) (bool, error) {
	var err C.virError
	result := C.virDomainSnapshotIsCurrentWrapper(s.ptr, C.uint(flags), &err)
	if result == -1 {
		return false, makeError(&err)
	}
	if result == 1 {
		return true, nil
	}
	return false, nil
}
527542
func SaveBitmap(bitmap C.MMBitmapRef, gpath string, args ...int) string {
	var mtype C.uint16_t = 1
	if len(args) > 0 {
		mtype = C.uint16_t(args[0])
	}

	path := C.CString(gpath)
	saveBit := C.bitmap_save(bitmap, path, mtype)
	C.free(unsafe.Pointer(path))

	return C.GoString(saveBit)
}
1282329
func IsRemote(path string) bool {
	return strings.HasPrefix(path, "http://") || strings.HasPrefix(path, "https://")
}
125287
func NewSocketTransport(path string) *http.Transport {
	socket := NewSocketRoundTripper(path)
	transport := &http.Transport{}
	transport.RegisterProtocol("unix", socket)
	return transport
}
474042
func (s *simpleProvider) isValidHostPort(port int32) bool {
	for _, hostPortRange := range s.psp.Spec.HostPorts {
		if port >= hostPortRange.Min && port <= hostPortRange.Max {
			return true
		}
	}
	return false
}
41036
func PDFHasImage(path string) bool {
	cmd := "pdffonts -l 5 %s | tail -n +3 | cut -d' ' -f1 | sort | uniq"
	out, err := exec.Command("bash", "-c", fmt.Sprintf(cmd, path)).Output()
	if err != nil {
		log.Println(err)
		return false
	}
	if string(out) == "" {
		return true
	}
	return false
}
1180036
func main() {
	bucketPtr := flag.String("bucket", "", "bucket to upload to")
	regionPtr := flag.String("region", "", "region to be used when making requests")
	pathPtr := flag.String("path", "", "path of directory to be synced")
	flag.Parse()

	sess := session.New(&aws.Config{
		Region: regionPtr,
	})
	uploader := s3manager.NewUploader(sess)

	iter := NewSyncFolderIterator(*pathPtr, *bucketPtr)
	if err := uploader.UploadWithIterator(aws.BackgroundContext(), iter); err != nil {
		fmt.Fprintf(os.Stderr, "unexpected error has occurred: %v", err)
	}

	if err := iter.Err(); err != nil {
		fmt.Fprintf(os.Stderr, "unexpected error occurred during file walking: %v", err)
	}

	fmt.Println("Success")
}
21419
func (ftp *FTP) Pwd() (path string, err error) {
	var line string
	if line, err = ftp.cmd(StatusPathCreated, "PWD"); err != nil {
		return
	}

	res := RePwdPath.FindAllStringSubmatch(line[4:], -1)

	path = res[0][1]
	return
}
700704
func (v *VPCRouter) HasPPTPServer() bool {
	return v.HasSetting() && v.Settings.Router.HasPPTPServer()
}
612854
func IsDirReal(path string) (bool, error) {
	fileInfo, err := os.Lstat(path)
	if err != nil {
		return false, err
	}
	// Check if symlink
	if fileInfo.Mode()&os.ModeSymlink != 0 {
		return false, fmt.Errorf("Path is a symlink")
	}
	if !fileInfo.Mode().IsDir() {
		return false, fmt.Errorf("Path is not a directory")
	}
	return true, nil
}
747842
func (r ServerMuxList) Find(path string) (interface{}, bool) {
	for _, p := range r {
		if p.PathPrefix == path || strings.HasPrefix(path, p.PathPrefix) {
			return p.Callback, true
		}
	}
	return nil, false
}
315596
func verifyDstPathSafe(dst string) error {
	if _, err := os.Stat(dst); !os.IsNotExist(err) {
		return errors.Wrapf(err, "destination path %s already exists", dst)
	}
	if _, err := os.Stat(path.Dir(dst)); os.IsNotExist(err) {
		return errors.Wrapf(err, "parent directory of destination path %s does not exist", dst)
	}
	return nil
}
1133555
func (mounter *Mounter) IsMountPointMatch(mp MountPoint, dir string) bool {
	return mp.Path == dir
}
890194
func (c *ConfigLocal) IsSyncedTlfPath(tlfPath string) bool {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.syncedTlfPaths[tlfPath]
}