Репозитории ALT
S: | 2.4.7-alt1 |
5.1: | 1.4.2-alt1.M51.2 |
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 |
Группа :: Система/Серверы
Пакет: cups
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: cups-1.4.0-debian-pidfile.patch
Скачать
Скачать
diff -Naur cups-1.4.0.orig/scheduler/conf.c cups-1.4.0/scheduler/conf.c
--- cups-1.4.0.orig/scheduler/conf.c 2009-05-26 19:41:04 +0400
+++ cups-1.4.0/scheduler/conf.c 2009-09-15 14:40:47 +0400
@@ -184,7 +184,8 @@
#endif /* HAVE_AUTHORIZATION_H */
{ "TempDir", &TempDir, CUPSD_VARTYPE_PATHNAME },
{ "Timeout", &Timeout, CUPSD_VARTYPE_INTEGER },
- { "UseNetworkDefault", &UseNetworkDefault, CUPSD_VARTYPE_BOOLEAN }
+ { "UseNetworkDefault", &UseNetworkDefault, CUPSD_VARTYPE_BOOLEAN },
+ { "PidFile", &PidFile, CUPSD_VARTYPE_STRING }
};
#define NUM_VARS (sizeof(variables) / sizeof(variables[0]))
@@ -506,6 +507,7 @@
cupsdSetString(&RemoteRoot, "remroot");
cupsdSetString(&ServerHeader, "CUPS/1.4");
cupsdSetString(&StateDir, CUPS_STATEDIR);
+ cupsdSetString(&PidFile, "/var/run/cups/cupsd.pid");
if (!strcmp(CUPS_DEFAULT_PRINTCAP, "/etc/printers.conf"))
PrintcapFormat = PRINTCAP_SOLARIS;
diff -Naur cups-1.4.0.orig/scheduler/conf.h cups-1.4.0/scheduler/conf.h
--- cups-1.4.0.orig/scheduler/conf.h 2009-05-12 02:46:01 +0400
+++ cups-1.4.0/scheduler/conf.h 2009-09-15 14:40:47 +0400
@@ -249,6 +249,8 @@
VAR int SSLOptions VALUE(CUPSD_SSL_NONE);
/* SSL/TLS options */
#endif /* HAVE_SSL */
+VAR char *PidFile VALUE(NULL);
+ /* Debian CUPS pid file */
#ifdef HAVE_LAUNCHD
VAR int LaunchdTimeout VALUE(DEFAULT_KEEPALIVE);
diff -Naur cups-1.4.0.orig/scheduler/main.c cups-1.4.0/scheduler/main.c
--- cups-1.4.0.orig/scheduler/main.c 2009-05-18 19:43:32 +0400
+++ cups-1.4.0/scheduler/main.c 2009-09-15 14:40:47 +0400
@@ -89,6 +89,8 @@
static void sigterm_handler(int sig);
static long select_timeout(int fds);
static void usage(int status);
+int write_pid(void);
+int remove_pid(void);
/*
@@ -632,6 +634,11 @@
}
#endif /* __sgi */
+ if (write_pid() == 0) {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to write pid file");
+ return (1);
+ }
+
/*
* Initialize authentication certificates...
*/
@@ -1220,10 +1227,41 @@
cupsdStopSelect();
+ remove_pid();
+
return (!stop_scheduler);
}
+/* 'write_pid()' - Write PID file.
+ 'remove_pid()' - Delete PID file.
+*/
+int
+write_pid()
+{
+ FILE *f;
+ int fd;
+ int pid;
+ if (((fd = open(PidFile, O_RDWR|O_CREAT, 0644)) == -1)
+ || ((f = fdopen(fd, "r+")) == NULL) ) {
+ return 0;
+ }
+ pid = getpid();
+ if (!fprintf(f, "%d\n", pid)) {
+ close(fd);
+ return 0;
+ }
+ fflush(f);
+ close(fd);
+
+ return pid;
+}
+
+int
+remove_pid() {
+ return unlink(PidFile);
+}
+
/*
* 'cupsdCheckProcess()' - Tell the main loop to check for dead children.
*/
diff -Naur cups-1.4.0.orig/test/run-stp-tests.sh cups-1.4.0/test/run-stp-tests.sh
--- cups-1.4.0.orig/test/run-stp-tests.sh 2009-04-28 01:15:23 +0400
+++ cups-1.4.0/test/run-stp-tests.sh 2009-09-15 14:40:47 +0400
@@ -334,6 +334,7 @@
DocumentRoot $root/doc
RequestRoot /tmp/cups-$user/spool
TempDir /tmp/cups-$user/spool/temp
+PidFile /tmp/cups-$user/cupsd.pid
MaxSubscriptions 3
MaxLogSize 0
AccessLog /tmp/cups-$user/log/access_log