summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2009-08-25 20:05:21 +0100
committerforsyth <forsyth@vitanuova.com>2009-08-25 20:05:21 +0100
commit9cc6081ecb7a8f3f2cd63eaa9f6cd3df4f9fb801 (patch)
tree6aeaf8f468e036eac546e850c0c974484db2c4b3
parent74173b64021e5a33c09562a07fa63011a7369f0b (diff)
20090825-2005
-rw-r--r--CHANGES2
-rw-r--r--appl/cmd/ftpfs.b38
-rw-r--r--dis/ftpfs.disbin22720 -> 22803 bytes
-rw-r--r--include/version.h2
4 files changed, 18 insertions, 24 deletions
diff --git a/CHANGES b/CHANGES
index 0834f857..7642b456 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20090825
+ add netmkaddr call to /appl/cmd/ftpfs.b; send errors to standard error
20090824
delete unused (and somewhat incomplete) pin support
20090822
diff --git a/appl/cmd/ftpfs.b b/appl/cmd/ftpfs.b
index afb152c1..ee5a44d4 100644
--- a/appl/cmd/ftpfs.b
+++ b/appl/cmd/ftpfs.b
@@ -202,10 +202,11 @@ connect(): string
return nil;
}
-#shut(s: string)
-#{
-# sys->print("ftpfs: %s shutdown\n", s);
-#}
+error(s: string)
+{
+ sys->fprint(sys->fildes(2), "ftpfs: %s\n", s);
+ raise "fail:"+s;
+}
#
# Mount server. Must be spawned because it does
@@ -214,8 +215,8 @@ connect(): string
mount(mountpoint: string)
{
- if (sys->mount(mountfd, nil, mountpoint, sys->MREPL | sys->MCREATE, nil) < 0) {
- sys->print("mount %s failed: %r\n", mountpoint);
+ if (sys->mount(mountfd, nil, mountpoint, Sys->MREPL | Sys->MCREATE, nil) < 0) {
+ sys->fprint(sys->fildes(2), "ftpfs: mount %s failed: %r\n", mountpoint);
shutdown();
}
mountfd = nil;
@@ -1596,12 +1597,10 @@ init(nil: ref Draw->Context, args: list of string)
if (debug)
sys->print("proxyhost %s\n", proxyhost);
} else {
- d := "tcp!" + hostname + "!ftp";
+ d := dial->netmkaddr(hostname, "tcp", "ftp");
ftp = dial->dial(d, nil);
- if(ftp == nil) {
- sys->print("dial %s failed: %r\n", d);
- exit;
- }
+ if(ftp == nil)
+ error(sys->sprint("dial %s failed: %r", d));
if(debug)
sys->print("localdir %s\n", ftp.dir);
dfid = ftp.dfd;
@@ -1685,20 +1684,13 @@ init(nil: ref Draw->Context, args: list of string)
spawn server(); # dies when receive on chan fails
}
-kill(pid: int): int
+kill(pid: int)
{
if (debug)
sys->print("killing %d\n", pid);
- fd := sys->open("/prog/"+string pid+"/ctl", Sys->OWRITE);
- if (fd == nil) {
- sys->print("kill: open failed\n");
- return -1;
- }
- if (sys->write(fd, array of byte "kill", 4) != 4) {
- sys->print("kill: write failed\n");
- return -1;
- }
- return 0;
+ fd := sys->open("#p/"+string pid+"/ctl", Sys->OWRITE);
+ if(fd != nil)
+ sys->fprint(fd, "kill");
}
shutdown()
@@ -1911,7 +1903,7 @@ clunkT(t: ref Tmsg.Clunk)
f := getfid(t.fid);
if (f.node.fileisdirty()) {
if (f.node.createfile() < 0)
- sys->print("ftpfs: could not create %s\n", f.node.pathname());
+ sys->print("ftpfs: could not create %s: %r\n", f.node.pathname());
f.node.fileclean();
f.node.uncache();
}
diff --git a/dis/ftpfs.dis b/dis/ftpfs.dis
index a7483a3d..22fcb23f 100644
--- a/dis/ftpfs.dis
+++ b/dis/ftpfs.dis
Binary files differ
diff --git a/include/version.h b/include/version.h
index da14152d..67d54a62 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20090824)"
+#define VERSION "Fourth Edition (20090825)"