mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
acme: report close failure in Put, this time for sure
Missed in 0b349f6f
that Bterm is not closing fd.
This commit is contained in:
parent
f6c9f7b14c
commit
93e2e820a5
1 changed files with 5 additions and 5 deletions
|
@ -699,7 +699,7 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
|
||||||
Rune *r;
|
Rune *r;
|
||||||
Biobuf *b;
|
Biobuf *b;
|
||||||
char *s, *name;
|
char *s, *name;
|
||||||
int i, fd, q, ret;
|
int i, fd, q, ret, retc;
|
||||||
Dir *d, *d1;
|
Dir *d, *d1;
|
||||||
Window *w;
|
Window *w;
|
||||||
int isapp;
|
int isapp;
|
||||||
|
@ -763,9 +763,10 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
|
||||||
goto Rescue2;
|
goto Rescue2;
|
||||||
}
|
}
|
||||||
ret = Bterm(b);
|
ret = Bterm(b);
|
||||||
|
retc = close(fd);
|
||||||
free(b);
|
free(b);
|
||||||
b = nil;
|
b = nil;
|
||||||
if(ret < 0) {
|
if(ret < 0 || retc < 0) {
|
||||||
warning(nil, "can't write file %s: %r\n", name);
|
warning(nil, "can't write file %s: %r\n", name);
|
||||||
goto Rescue2; // flush or close failed
|
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.
|
// in case we don't have read permission.
|
||||||
// (The create above worked, so we probably
|
// (The create above worked, so we probably
|
||||||
// still have write permission.)
|
// still have write permission.)
|
||||||
close(fd);
|
|
||||||
fd = open(name, OWRITE);
|
fd = open(name, OWRITE);
|
||||||
|
|
||||||
d1 = dirfstat(fd);
|
d1 = dirfstat(fd);
|
||||||
|
close(fd);
|
||||||
if(d1 != nil){
|
if(d1 != nil){
|
||||||
free(d);
|
free(d);
|
||||||
d = d1;
|
d = d1;
|
||||||
|
@ -821,11 +821,11 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
|
||||||
if(b != nil) {
|
if(b != nil) {
|
||||||
Bterm(b);
|
Bterm(b);
|
||||||
free(b);
|
free(b);
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
free(h);
|
free(h);
|
||||||
fbuffree(s);
|
fbuffree(s);
|
||||||
fbuffree(r);
|
fbuffree(r);
|
||||||
close(fd);
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
Rescue1:
|
Rescue1:
|
||||||
|
|
Loading…
Reference in a new issue