]> Cypherpunks repositories - gostls13.git/commitdiff
fix error return in Remove
authorRuss Cox <rsc@golang.org>
Tue, 14 Apr 2009 02:14:09 +0000 (19:14 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 14 Apr 2009 02:14:09 +0000 (19:14 -0700)
change canexec to canExec.

R=r
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=27393
CL=27398

src/lib/exec.go
src/lib/os/file.go

index effb46fa450f1fb05b7c961bdbcb39be913de3d5..425b94eb3ac8ecef0bbddfced6debb719511f18d 100644 (file)
@@ -184,7 +184,7 @@ func (p *Cmd) Close() *os.Error {
        return err;
 }
 
-func canexec(file string) bool{
+func canExec(file string) bool{
        d, err := os.Stat(file);
        if err != nil {
                return false;
@@ -203,7 +203,7 @@ func LookPath(file string) (string, *os.Error) {
        // 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;
@@ -219,7 +219,7 @@ func LookPath(file string) (string, *os.Error) {
                        // Unix shell semantics: path element "" means "."
                        dir = ".";
                }
-               if canexec(dir+"/"+file) {
+               if canExec(dir+"/"+file) {
                        return dir+"/"+file, nil;
                }
        }
index 80f43bb5939a9e534cbe23cf6e239efc9f6b2b8d..9e98be697a6c96315a9450931e2db152e1564e3d 100644 (file)
@@ -287,13 +287,13 @@ func Remove(name string) *os.Error {
        // 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);
 }