diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-08-19 11:48:29 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-08-19 11:48:29 +0900 |
commit | 4a2f14638f56197f26c2e1bcc642cf963f21c5e3 (patch) | |
tree | fa30c424db55de9a3a687dd43b74c44dded8920e | |
parent | a739d4d7da5ff7053ab63c72eed632c246fe17b0 (diff) | |
download | efl-4a2f14638f56197f26c2e1bcc642cf963f21c5e3.tar.gz |
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
-rw-r--r-- | src/bin/efreet/efreetd.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/bin/efreet/efreetd.c b/src/bin/efreet/efreetd.c index 1c56a9dbcb..839cd607b2 100644 --- a/src/bin/efreet/efreetd.c +++ b/src/bin/efreet/efreetd.c @@ -8,6 +8,9 @@ #include <sys/time.h> #include <sys/resource.h> #endif +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include <Ecore.h> #include <Ecore_File.h> @@ -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; |