From c27b7fd8a10207d5c1802370b2bb8c2dbcd7f153 Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Sun, 6 Dec 2009 23:33:03 +0100 Subject: fix a bug in printf.c. --- libddekit/printf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libddekit/printf.c') 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; -- cgit v1.2.3