[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] check return value of fclose while writing to disk, since i...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] check return value of fclose while writing to disk, since i...
- From: arma@seul.org (Roger Dingledine)
- Date: Fri, 23 Jul 2004 17:25:31 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Fri, 23 Jul 2004 17:25:44 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common
Modified Files:
util.c
Log Message:
check return value of fclose while writing to disk, since it might
return out-of-space, etc
Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- util.c 22 Jul 2004 08:29:07 -0000 1.115
+++ util.c 23 Jul 2004 21:25:28 -0000 1.116
@@ -1334,7 +1334,10 @@
fclose(file);
return -1;
}
- fclose(file);
+ if (fclose(file) == EOF) {
+ log(LOG_WARN,"Error flushing to %s: %s", tempname, strerror(errno));
+ return -1;
+ }
#ifdef MS_WINDOWS
/* On Windows, rename doesn't replace. We could call ReplaceFile, but