Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37047154
en ru br
ALT Linux repositórios
S:2.4.7-alt1
5.0: 1.3.10-alt1
4.1: 1.3.10-alt0.M41.4
+updates:1.3.9-alt1.M41.1
4.0: 1.2.12-alt6.M40.9
+updates:1.2.12-alt6.M40.8
3.0: 1.1.20-alt14.1

Group :: Sistema/Servidores
RPM: cups

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: FC-logrotate.patch
Download


diff -up cups-2.1b1/scheduler/log.c.logrotate cups-2.1b1/scheduler/log.c
--- cups-2.1b1/scheduler/log.c.logrotate	2015-06-04 20:00:31.000000000 +0200
+++ cups-2.1b1/scheduler/log.c	2015-06-29 13:25:09.623350218 +0200
@@ -26,6 +26,9 @@
 #  include <systemd/sd-journal.h>
 #endif /* HAVE_ASL_H */
 #include <syslog.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 
 /*
@@ -135,12 +138,10 @@ cupsdCheckLogFile(cups_file_t **lf,	/* I
   }
 
  /*
-  * Format the filename as needed...
+  * Format the filename...
   */
 
-  if (!*lf ||
-      (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize &&
-       MaxLogSize > 0))
+  if (strncmp(logname, "/dev/", 5))
   {
    /*
     * Handle format strings...
@@ -254,6 +255,34 @@ cupsdCheckLogFile(cups_file_t **lf,	/* I
      /*
       * Change ownership and permissions of non-device logs...
       */
+
+      fchown(cupsFileNumber(*lf), RunUser, Group);
+      fchmod(cupsFileNumber(*lf), LogFilePerm);
+    }
+  }
+
+ /*
+  * Has someone else (i.e. logrotate) already rotated the log for us?
+  */
+  else if (strncmp(filename, "/dev/", 5))
+  {
+    struct stat st;
+    if (stat(filename, &st) || st.st_size == 0)
+    {
+      /* File is either missing or has zero size. */
+
+      cupsFileClose(*lf);
+      if ((*lf = cupsFileOpen(filename, "a")) == NULL)
+      {
+	syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
+             strerror(errno));
+
+	return (0);
+      }
+
+     /*
+      * Change ownership and permissions of non-device logs...
+      */
 
       fchown(cupsFileNumber(*lf), RunUser, Group);
       fchmod(cupsFileNumber(*lf), LogFilePerm);
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009