소스 검색

check return value of fclose while writing to disk, since it might
return out-of-space, etc


svn:r2122

Roger Dingledine 22 년 전
부모
커밋
5525606653
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/common/util.c

+ 4 - 1
src/common/util.c

@@ -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