From: munkyu.im Date: Thu, 26 Dec 2013 07:59:28 +0000 (+0900) Subject: ecs: add checking error case X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~528^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba70f9b9a2da5e81dc9c9879cbd0f7dce6acedce;p=sdk%2Femulator%2Fqemu.git ecs: add checking error case returns when occur error case Change-Id: Ib2ad461e2bd99b73f3a22d72656a165d02bfa16c Signed-off-by: munkyu.im --- diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 37f409b812..bcff82db2d 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -170,16 +170,42 @@ static inline void start_logging(void) { stdout[0] = flog[0]; stderr[0] = flog[0]; + + g_free(path); #else log_fd = open("/dev/null", O_RDONLY); - dup2(log_fd, 0); + if(log_fd < 0) { + fprintf(stderr, "failed to open() /dev/null\n"); + return; + } + if(dup2(log_fd, 0) < 0) { + fprintf(stderr, "failed to dup2(log_fd, 0)\n"); + return; + } log_fd = creat(path, 0640); if (log_fd < 0) { log_fd = open("/dev/null", O_WRONLY); + if(log_fd < 0) { + fprintf(stderr, "failed to open(/dev/null, O_WRONLY)\n"); + g_free(path); + return; + } } - dup2(log_fd, 1); - dup2(log_fd, 2); + + if(dup2(log_fd, 1) < 0) { + fprintf(stderr, "failed to dup2(log_fd, 1)\n"); + g_free(path); + return; + } + + if(dup2(log_fd, 2) < 0) { + fprintf(stderr, "failed to dup2(log_fd, 2)\n"); + g_free(path); + return; + } + + g_free(path); #endif }