diff options
author | Zheng Da <zhengda1936@gmail.com> | 2009-12-06 23:33:03 +0100 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2009-12-06 23:33:03 +0100 |
commit | c27b7fd8a10207d5c1802370b2bb8c2dbcd7f153 (patch) | |
tree | f7c43e3672a9c52be082ba57954519c63f067670 /libddekit/printf.c | |
parent | 974a402ed6a28e7801f3c6202516ef232d73256a (diff) |
fix a bug in printf.c.
Diffstat (limited to 'libddekit/printf.c')
-rw-r--r-- | libddekit/printf.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libddekit/printf.c b/libddekit/printf.c index 72ff5003..1996987f 100644 --- a/libddekit/printf.c +++ b/libddekit/printf.c @@ -71,10 +71,16 @@ int ddekit_vprintf(const char *fmt, va_list va) int log_init () { - char *log_file_name = mktemp ("/tmp/dde_log.XXXXXX"); - output = fopen (log_file_name, "a+"); + char template[] = "/var/log/dde_log.XXXXXX"; + int ret = mkstemp (template); + if (ret < 0) { + error (0, errno, "mkstemp"); + return -1; + } + + output = fopen (template, "a+"); if (!output) { - error (0, errno, "open %s", log_file_name); + error (0, errno, "open %s", template); return -1; } return 0; |