return err;
}
-func canexec(file string) bool{
+func canExec(file string) bool{
d, err := os.Stat(file);
if err != nil {
return false;
// but that would not match all the Unix shells.
if strings.Index(file, "/") >= 0 {
- if canexec(file) {
+ if canExec(file) {
return file, nil;
}
return "", os.ENOENT;
// Unix shell semantics: path element "" means "."
dir = ".";
}
- if canexec(dir+"/"+file) {
+ if canExec(dir+"/"+file) {
return dir+"/"+file, nil;
}
}
// returns EISDIR, so can't use that. However,
// both agree that rmdir(file) returns ENOTDIR,
// so we can use that to decide which error is real.
- // Rmdir might return ENOTDIR if given a bad
+ // Rmdir might also return ENOTDIR if given a bad
// file path, like /etc/passwd/foo, but in that case,
// both errors will be ENOTDIR, so it's okay to
// use the error from unlink.
if e1 != syscall.ENOTDIR {
e = e1;
}
- return ErrnoToError(e1);
+ return ErrnoToError(e);
}