use NoInt() wrappers in FileUtil
authorPhilip Pronin <philipp@fb.com>
Fri, 30 May 2014 07:05:28 +0000 (00:05 -0700)
committerAnton Likhtarov <alikhtarov@fb.com>
Mon, 9 Jun 2014 22:35:20 +0000 (15:35 -0700)
Summary:
Accidentally spotted this problem.  `folly/FileUtil.h` and
`common/files/FileUtil.h` are now using `*NoInt` wrappers where appropriate.

Test Plan: fbconfig -r common/files folly && fbmake opt -j32

Reviewed By: lucian@fb.com

Subscribers: folly@lists, fbcode-common-diffs@lists

FB internal diff: D1356261

folly/FileUtil.h

index 13dbe5a0f8bd8c06bfc39a54ccc5e2810aea8238..4eb56df37775215fc235434405a0bde37afcde65 100644 (file)
@@ -123,7 +123,7 @@ bool readFile(const char* file_name, Container& out,
                 "readFile: only containers with byte-sized elements accepted");
   assert(file_name);
 
-  const auto fd = open(file_name, O_RDONLY);
+  const auto fd = openNoInt(file_name, O_RDONLY);
   if (fd == -1) return false;
 
   size_t soFar = 0; // amount of bytes successfully read
@@ -131,7 +131,7 @@ bool readFile(const char* file_name, Container& out,
     assert(out.size() >= soFar); // resize better doesn't throw
     out.resize(soFar);
     // Ignore errors when closing the file
-    close(fd);
+    closeNoInt(fd);
   };
 
   // Obtain file size: