open() can fail for various reasons, so check for valid 'fd' return
authorChris Michael <cp.michael@samsung.com>
Mon, 5 Aug 2013 10:34:34 +0000 (11:34 +0100)
committerChris Michael <cp.michael@samsung.com>
Mon, 5 Aug 2013 10:34:34 +0000 (11:34 +0100)
before calling fdopen.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/eet/eet_lib.c

index a8d507eb54dc1df33840b27ed3c99fef3ee809ff..f85209aa9816209723c8562d4e01400a80913f7c 100644 (file)
@@ -351,6 +351,9 @@ eet_flush2(Eet_File *ef)
         /* opening for write - delete old copy of file right away */
         unlink(ef->path);
         fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
+        if (fd < 0) 
+          return EET_ERROR_NOT_WRITABLE;
+
         fp = fdopen(fd, "wb");
         if (!fp)
           return EET_ERROR_NOT_WRITABLE;