From: Carsten Haitzler (Rasterman) Date: Fri, 19 Aug 2016 02:48:29 +0000 (+0900) Subject: efreetd - only open log file is env var is set to do so X-Git-Tag: upstream/1.20.0~4705 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a2f14638f56197f26c2e1bcc642cf963f21c5e3;p=platform%2Fupstream%2Fefl.git efreetd - only open log file is env var is set to do so set EFREETD_LOG to something to get efreetd to log. otherwise efretd log files can end up rather larth and since they go in xdg_runtimedir - thats mostly a ramdisk... they eat actual ram. so save a lot of memory and only log if asked to. @fix --- diff --git a/src/bin/efreet/efreetd.c b/src/bin/efreet/efreetd.c index 1c56a9d..839cd60 100644 --- a/src/bin/efreet/efreetd.c +++ b/src/bin/efreet/efreetd.c @@ -8,6 +8,9 @@ #include #include #endif +#include +#include +#include #include #include @@ -55,13 +58,20 @@ main(int argc, char *argv[]) hostname_str = ""; else hostname_str = buf; - snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log", - log_file_dir, hostname_str); - fd = eina_file_mkstemp(path, NULL); - if (fd < 0) + if (getenv("EFREETD_LOG")) { - ERR("Can't create log file '%s'\b", path);; - goto tmp_error; + snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log", + log_file_dir, hostname_str); + fd = eina_file_mkstemp(path, NULL); + if (fd < 0) + { + ERR("Can't create log file '%s'\b", path);; + goto tmp_error; + } + } + else + { + fd = open("/dev/null", O_WRONLY); } log = fdopen(fd, "wb"); if (!log) goto tmp_error;