summaryrefslogtreecommitdiff
path: root/src/lib/eet/eet_lib.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-08-05 11:34:34 +0100
committerChris Michael <cp.michael@samsung.com>2013-08-05 11:34:34 +0100
commitcc0bbacb8971fdb7ece1b168e53cb2001fd15f47 (patch)
tree5b6c304f63a087efc4b94d2642b3f863461352d6 /src/lib/eet/eet_lib.c
parent8270fc29f3964f96d7029d5c3dcebe5be8bb5bff (diff)
open() can fail for various reasons, so check for valid 'fd' return
before calling fdopen. Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/eet/eet_lib.c')
-rw-r--r--src/lib/eet/eet_lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index a8d507eb54..f85209aa98 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -351,6 +351,9 @@ eet_flush2(Eet_File *ef)
351 /* opening for write - delete old copy of file right away */ 351 /* opening for write - delete old copy of file right away */
352 unlink(ef->path); 352 unlink(ef->path);
353 fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR); 353 fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
354 if (fd < 0)
355 return EET_ERROR_NOT_WRITABLE;
356
354 fp = fdopen(fd, "wb"); 357 fp = fdopen(fd, "wb");
355 if (!fp) 358 if (!fp)
356 return EET_ERROR_NOT_WRITABLE; 359 return EET_ERROR_NOT_WRITABLE;