diff options
author | Russ Cox <rsc@swtch.com> | 2020-01-24 13:08:36 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2020-01-24 13:09:11 -0500 |
commit | 93e2e820a5551ba3d0a1e0f0fbd4c5eb65e18ce6 (patch) | |
tree | bd5e3cce955cc638da1961dc865f6bdcc13f3dbf /src/cmd/acme | |
parent | f6c9f7b14c9dce53fff6020200b28c4e25621e87 (diff) | |
download | plan9port-93e2e820a5551ba3d0a1e0f0fbd4c5eb65e18ce6.tar.gz plan9port-93e2e820a5551ba3d0a1e0f0fbd4c5eb65e18ce6.tar.bz2 plan9port-93e2e820a5551ba3d0a1e0f0fbd4c5eb65e18ce6.zip |
acme: report close failure in Put, this time for sure
Missed in 0b349f6f that Bterm is not closing fd.
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/exec.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index 1d50f92f..be7936ae 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -699,7 +699,7 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname) Rune *r; Biobuf *b; char *s, *name; - int i, fd, q, ret; + int i, fd, q, ret, retc; Dir *d, *d1; Window *w; int isapp; @@ -763,9 +763,10 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname) goto Rescue2; } ret = Bterm(b); + retc = close(fd); free(b); b = nil; - if(ret < 0) { + if(ret < 0 || retc < 0) { warning(nil, "can't write file %s: %r\n", name); goto Rescue2; // flush or close failed } @@ -785,10 +786,9 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname) // in case we don't have read permission. // (The create above worked, so we probably // still have write permission.) - close(fd); fd = open(name, OWRITE); - d1 = dirfstat(fd); + close(fd); if(d1 != nil){ free(d); d = d1; @@ -821,11 +821,11 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname) if(b != nil) { Bterm(b); free(b); + close(fd); } free(h); fbuffree(s); fbuffree(r); - close(fd); /* fall through */ Rescue1: |