]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/log.c
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / log.c
index 11c3cbcfe1a9d0134e369c115ff6b3520400a8df..2c7c573e2ae90b23a0d8871e1fa9a72000a65b93 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * "$Id: log.c 6328 2007-03-12 14:45:42Z mike $"
+ * "$Id: log.c 6492 2007-04-30 19:31:36Z mike $"
  *
  *   Log file routines for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Easy Software Products and are protected by Federal
@@ -546,10 +546,23 @@ check_log_file(cups_file_t **lf,  /* IO - Log file */
 
     if ((*lf = cupsFileOpen(filename, "a")) == NULL)
     {
-      syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
-             strerror(errno));
+     /*
+      * If the file is in CUPS_LOGDIR then try to create a missing directory...
+      */
 
-      return (0);
+      if (!strncmp(filename, CUPS_LOGDIR, strlen(CUPS_LOGDIR)))
+      {
+        cupsdCheckPermissions(CUPS_LOGDIR, NULL, 0755, RunUser, Group, 1, -1);
+
+        *lf = cupsFileOpen(filename, "a");
+      }
+
+      if (*lf == NULL)
+      {
+       syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
+              strerror(errno));
+       return (0);
+      }
     }
 
     if (strncmp(filename, "/dev/", 5))
@@ -603,5 +616,5 @@ check_log_file(cups_file_t **lf,    /* IO - Log file */
 
 
 /*
- * End of "$Id: log.c 6328 2007-03-12 14:45:42Z mike $".
+ * End of "$Id: log.c 6492 2007-04-30 19:31:36Z mike $".
  */