s3-spoolssd: Fixed reopening of logs.
authorAndreas Schneider <asn@samba.org>
Wed, 25 Aug 2010 08:15:47 +0000 (10:15 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 29 Mar 2011 14:03:51 +0000 (16:03 +0200)
Everytime the log was reopened a .spoolssd has been appended which
resulted in long file names.

Signed-off-by: Günther Deschner <gd@samba.org>
source3/printing/spoolssd.c

index 0ba0a95435a14d37d84f380efb4bca700fa1857b..899a1f35301752c355e62a61109c883fc0534c0f 100644 (file)
 #include "rpc_server/rpc_server.h"
 
 #define SPOOLSS_PIPE_NAME "spoolss"
-
+#define DAEMON_NAME "spoolssd"
 
 static void spoolss_reopen_logs(void)
 {
-       char *lfile = NULL;
-       int ret;
-
-       ret = asprintf(&lfile, "%s.spoolssd", lp_logfile());
-       if (ret > 0) {
-               lp_set_logfile(lfile);
-               SAFE_FREE(lfile);
+       char *lfile = lp_logfile();
+       int rc;
+
+       if (strstr(lfile, DAEMON_NAME) == NULL) {
+               rc = asprintf(&lfile, "%s.%s", lp_logfile(), DAEMON_NAME);
+               if (rc > 0) {
+                       lp_set_logfile(lfile);
+                       SAFE_FREE(lfile);
+               }
        }
        reopen_logs();
 }