]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
print an error message to stdout if we failed to open the logfile for
authorRonnie Sahlberg <sahlberg@ronnie>
Sun, 3 Jun 2007 08:59:27 +0000 (18:59 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Sun, 3 Jun 2007 08:59:27 +0000 (18:59 +1000)
the daemon

(This used to be ctdb commit fca953b1a3f3d6bf18264ecda1c75c68b60e2008)

ctdb/common/ctdb.c

index 4464bef9c72013b52d34c8d8e68b178a0a2bcf1e..b54fb312c99b00fdf2c5a9192f24232d85c22b76 100644 (file)
@@ -52,12 +52,13 @@ int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile)
        ctdb->logfile = talloc_strdup(ctdb, logfile);
        if (ctdb->logfile != NULL && strcmp(logfile, "-") != 0) {
                int fd;
-               close(1);
-               close(2);
                fd = open(ctdb->logfile, O_WRONLY|O_APPEND|O_CREAT, 0666);
                if (fd == -1) {
+                       printf("Failed to open logfile %s\n", ctdb->logfile);
                        abort();
                }
+               close(1);
+               close(2);
                if (fd != 1) {
                        dup2(fd, 1);
                        close(fd);