aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vbackup
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-06-01 08:50:49 -0400
committerRuss Cox <rsc@swtch.com>2008-06-01 08:50:49 -0400
commitff086a82325b22fcbd373edecfc3870e95049401 (patch)
tree3bf8ad8d01961c4633a4fbc71a2cb28bc8412a17 /src/cmd/vbackup
parentd29f5ece8b534180076e2859dcc014b3c36b00cf (diff)
downloadplan9port-ff086a82325b22fcbd373edecfc3870e95049401.tar.gz
plan9port-ff086a82325b22fcbd373edecfc3870e95049401.tar.bz2
plan9port-ff086a82325b22fcbd373edecfc3870e95049401.zip
vftp: walk fixes (Fazlul Shahriar)
Diffstat (limited to 'src/cmd/vbackup')
-rw-r--r--src/cmd/vbackup/vftp.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/vbackup/vftp.c b/src/cmd/vbackup/vftp.c
index 90af42e5..c413af42 100644
--- a/src/cmd/vbackup/vftp.c
+++ b/src/cmd/vbackup/vftp.c
@@ -54,6 +54,16 @@ ebuf(void)
return buf;
}
+static char*
+estrdup(char *s)
+{
+ char *t;
+
+ t = emalloc(strlen(s)+1);
+ strcpy(t, s);
+ return t;
+}
+
char*
walk(char *path, Nfs3Handle *ph)
{
@@ -61,6 +71,7 @@ walk(char *path, Nfs3Handle *ph)
Nfs3Handle h;
Nfs3Status ok;
+ path = estrdup(path); /* writable */
if(path[0] == '/')
h = root;
else
@@ -75,10 +86,12 @@ walk(char *path, Nfs3Handle *ph)
continue;
if((ok = fsyslookup(fsys, auth, &h, p, &h)) != Nfs3Ok){
nfs3errstr(ok);
+ free(path);
return ebuf();
}
}
*ph = h;
+ free(path);
return nil;
}
@@ -107,7 +120,7 @@ cmdcd(int argc, char **argv)
return err;
if((ok = fsysgetattr(fsys, auth, &h, &attr)) != Nfs3Ok){
nfs3errstr(ok);
- fprint(2, "%s: %r\n");
+ fprint(2, "%s: %r\n", argv[1]);
return nil;
}
if(attr.type != Nfs3FileDir)