]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
check return value of fclose while writing to disk, since it might
authorRoger Dingledine <arma@torproject.org>
Fri, 23 Jul 2004 21:25:28 +0000 (21:25 +0000)
committerRoger Dingledine <arma@torproject.org>
Fri, 23 Jul 2004 21:25:28 +0000 (21:25 +0000)
return out-of-space, etc

svn:r2122

src/common/util.c

index be4f60028a985554f1318cdcb72990a96d2b9cbc..5ccc58aedef49a3bc9b0c5f10de08fc5e3873647 100644 (file)
@@ -1334,7 +1334,10 @@ write_str_to_file(const char *fname, const char *str)
     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