diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | appl/cmd/ftpfs.b | 38 | ||||
| -rw-r--r-- | dis/ftpfs.dis | bin | 22720 -> 22803 bytes | |||
| -rw-r--r-- | include/version.h | 2 |
4 files changed, 18 insertions, 24 deletions
@@ -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 Binary files differindex a7483a3d..22fcb23f 100644 --- a/dis/ftpfs.dis +++ b/dis/ftpfs.dis 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)" |
