Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37729075
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: cups-1.3.10-debian-pidfile.patch
Download


#! /bin/sh /usr/share/dpatch/dpatch-run
## 47_pid.dpatch by Kenshi Muto <kmuto@debian.org>
##
## DP: Add support for creating pid files.
## DP: (http://www.cups.org/str.php?L2465)
@DPATCH@
diff -urNad trunk~/scheduler/conf.c trunk/scheduler/conf.c
--- trunk~/scheduler/conf.c	2009-01-25 12:03:35.000000000 +0100
+++ trunk/scheduler/conf.c	2009-01-25 12:03:37.000000000 +0100
@@ -169,7 +169,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]))
 
@@ -434,6 +435,7 @@
   cupsdSetString(&RemoteRoot, "remroot");
   cupsdSetString(&ServerHeader, "CUPS/1.3");
   cupsdSetString(&StateDir, CUPS_STATEDIR);
+  cupsdSetString(&PidFile, "/var/run/cups/cupsd.pid");
 #ifdef HAVE_GSSAPI
   cupsdSetString(&GSSServiceName, CUPS_DEFAULT_GSSSERVICENAME);
 #endif /* HAVE_GSSAPI */
diff -urNad trunk~/scheduler/conf.h trunk/scheduler/conf.h
--- trunk~/scheduler/conf.h	2008-02-16 00:26:51.000000000 +0100
+++ trunk/scheduler/conf.h	2009-01-25 12:03:37.000000000 +0100
@@ -189,6 +189,7 @@
 					/* Server key file */
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
 #endif /* HAVE_SSL */
+VAR char		*PidFile	VALUE(NULL); /* Debian CUPS pid file */
 
 #ifdef HAVE_LAUNCHD
 VAR int			LaunchdTimeout		VALUE(DEFAULT_TIMEOUT);
diff -urNad trunk~/scheduler/main.c trunk/scheduler/main.c
--- trunk~/scheduler/main.c	2008-09-07 23:58:01.000000000 +0200
+++ trunk/scheduler/main.c	2009-01-25 12:03:37.000000000 +0100
@@ -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);
 
 
 /*
@@ -596,6 +598,11 @@
   }
 #endif /* __sgi */
 
+  if (write_pid() == 0) {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to write pid file");
+    return (1);
+  }
+
  /*
   * Initialize authentication certificates...
   */
@@ -1182,9 +1189,39 @@
 
   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);
+}
+
 
 /*
  * 'cupsdClosePipe()' - Close a pipe as necessary.
diff -urNad trunk~/test/run-stp-tests.sh trunk/test/run-stp-tests.sh
--- trunk~/test/run-stp-tests.sh	2009-01-25 12:03:37.000000000 +0100
+++ trunk/test/run-stp-tests.sh	2009-01-25 12:03:59.000000000 +0100
@@ -307,6 +307,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
 
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