Fixed systemd socket activation support (bug #738709, bug #738710).

This commit is contained in:
Tim Waugh 2011-09-22 13:15:48 +01:00
parent 2c16ad0b31
commit 3188be0057
2 changed files with 50 additions and 23 deletions

View File

@ -1,6 +1,6 @@
diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/config-scripts/cups-systemd.m4
--- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket 2011-08-05 15:09:00.789855786 +0100
+++ cups-1.5.0/config-scripts/cups-systemd.m4 2011-08-05 15:09:00.789855786 +0100
--- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket 2011-09-22 13:01:02.909065794 +0100
+++ cups-1.5.0/config-scripts/cups-systemd.m4 2011-09-22 13:01:02.909065794 +0100
@@ -0,0 +1,25 @@
+dnl
+dnl "$Id$"
@ -29,7 +29,7 @@ diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/con
+dnl
diff -up cups-1.5.0/configure.in.systemd-socket cups-1.5.0/configure.in
--- cups-1.5.0/configure.in.systemd-socket 2010-11-20 01:03:46.000000000 +0000
+++ cups-1.5.0/configure.in 2011-08-05 15:09:00.789855786 +0100
+++ cups-1.5.0/configure.in 2011-09-22 13:01:02.910065775 +0100
@@ -37,6 +37,7 @@ sinclude(config-scripts/cups-pam.m4)
sinclude(config-scripts/cups-largefile.m4)
sinclude(config-scripts/cups-dnssd.m4)
@ -49,8 +49,8 @@ diff -up cups-1.5.0/configure.in.systemd-socket cups-1.5.0/configure.in
doc/help/ref-cupsd-conf.html
doc/help/standard.html
diff -up cups-1.5.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.in
--- cups-1.5.0/data/cups.path.in.systemd-socket 2011-08-05 15:09:00.790855758 +0100
+++ cups-1.5.0/data/cups.path.in 2011-08-05 15:09:00.790855758 +0100
--- cups-1.5.0/data/cups.path.in.systemd-socket 2011-09-22 13:01:02.911065757 +0100
+++ cups-1.5.0/data/cups.path.in 2011-09-22 13:01:02.911065757 +0100
@@ -0,0 +1,8 @@
+[Unit]
+Description=CUPS Printer Service Spool
@ -61,8 +61,8 @@ diff -up cups-1.5.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.i
+[Install]
+WantedBy=multi-user.target
diff -up cups-1.5.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.service.in
--- cups-1.5.0/data/cups.service.in.systemd-socket 2011-08-05 15:09:00.791855730 +0100
+++ cups-1.5.0/data/cups.service.in 2011-08-05 15:09:00.791855730 +0100
--- cups-1.5.0/data/cups.service.in.systemd-socket 2011-09-22 13:01:02.911065757 +0100
+++ cups-1.5.0/data/cups.service.in 2011-09-22 13:01:02.911065757 +0100
@@ -0,0 +1,9 @@
+[Unit]
+Description=CUPS Printing Service
@ -74,8 +74,8 @@ diff -up cups-1.5.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.ser
+Also=cups.socket cups.path
+WantedBy=printer.target
diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.socket.in
--- cups-1.5.0/data/cups.socket.in.systemd-socket 2011-08-05 15:09:00.791855730 +0100
+++ cups-1.5.0/data/cups.socket.in 2011-08-05 15:09:00.791855730 +0100
--- cups-1.5.0/data/cups.socket.in.systemd-socket 2011-09-22 13:01:02.911065757 +0100
+++ cups-1.5.0/data/cups.socket.in 2011-09-22 13:01:02.911065757 +0100
@@ -0,0 +1,9 @@
+[Unit]
+Description=CUPS Printing Service Sockets
@ -88,7 +88,7 @@ diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.sock
+WantedBy=sockets.target
diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
--- cups-1.5.0/data/Makefile.systemd-socket 2011-05-12 06:21:56.000000000 +0100
+++ cups-1.5.0/data/Makefile 2011-08-05 15:09:00.790855758 +0100
+++ cups-1.5.0/data/Makefile 2011-09-22 13:01:02.912065740 +0100
@@ -112,6 +112,12 @@ install-data:
$(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
done
@ -113,8 +113,8 @@ diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
#
diff -up cups-1.5.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
--- cups-1.5.0/Makedefs.in.systemd-socket 2011-08-05 15:08:39.672435367 +0100
+++ cups-1.5.0/Makedefs.in 2011-08-05 15:09:00.788855814 +0100
--- cups-1.5.0/Makedefs.in.systemd-socket 2011-09-22 13:01:02.732069025 +0100
+++ cups-1.5.0/Makedefs.in 2011-09-22 13:01:02.912065740 +0100
@@ -143,6 +143,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
CXXLIBS = @CXXLIBS@
DBUS_NOTIFIER = @DBUS_NOTIFIER@
@ -131,9 +131,32 @@ diff -up cups-1.5.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
#
diff -up cups-1.5.0/scheduler/client.h.systemd-socket cups-1.5.0/scheduler/client.h
--- cups-1.5.0/scheduler/client.h.systemd-socket 2011-03-25 21:25:38.000000000 +0000
+++ cups-1.5.0/scheduler/client.h 2011-09-22 13:09:10.016177338 +0100
@@ -75,6 +75,7 @@ typedef struct
int fd; /* File descriptor for this server */
http_addr_t address; /* Bind address of socket */
http_encryption_t encryption; /* To encrypt or not to encrypt... */
+ int is_systemd; /* Is this a systemd socket? */
} cupsd_listener_t;
diff -up cups-1.5.0/scheduler/listen.c.systemd-socket cups-1.5.0/scheduler/listen.c
--- cups-1.5.0/scheduler/listen.c.systemd-socket 2011-04-16 00:38:13.000000000 +0100
+++ cups-1.5.0/scheduler/listen.c 2011-09-22 13:14:20.173517762 +0100
@@ -401,7 +401,7 @@ cupsdStopListening(void)
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
{
- if (lis->fd != -1)
+ if (lis->fd != -1 && !lis->is_systemd)
{
#ifdef WIN32
closesocket(lis->fd);
diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
--- cups-1.5.0/scheduler/main.c.systemd-socket 2011-08-05 15:08:39.755433088 +0100
+++ cups-1.5.0/scheduler/main.c 2011-08-05 15:09:00.795855621 +0100
--- cups-1.5.0/scheduler/main.c.systemd-socket 2011-09-22 13:01:02.871066488 +0100
+++ cups-1.5.0/scheduler/main.c 2011-09-22 13:09:42.409586242 +0100
@@ -26,6 +26,8 @@
* launchd_checkin() - Check-in with launchd and collect the listening
* fds.
@ -185,7 +208,7 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
* Startup the server...
*/
@@ -1584,6 +1600,97 @@ launchd_checkout(void)
@@ -1584,6 +1600,98 @@ launchd_checkout(void)
}
#endif /* HAVE_LAUNCHD */
@ -194,7 +217,7 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
+{
+ int n, fd;
+
+ n = sd_listen_fds(1);
+ n = sd_listen_fds(0);
+ if (n < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
@ -273,6 +296,7 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
+ }
+
+ lis->fd = fd;
+ lis->is_systemd = 1;
+
+# ifdef HAVE_SSL
+ if (_httpAddrPort(&(lis->address)) == 443)
@ -284,8 +308,8 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
/*
* 'parent_handler()' - Catch USR1/CHLD signals...
diff -up cups-1.5.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makefile
--- cups-1.5.0/scheduler/Makefile.systemd-socket 2011-08-05 15:08:39.765432815 +0100
+++ cups-1.5.0/scheduler/Makefile 2011-08-05 15:09:22.170268932 +0100
--- cups-1.5.0/scheduler/Makefile.systemd-socket 2011-09-22 13:01:02.884066251 +0100
+++ cups-1.5.0/scheduler/Makefile 2011-09-22 13:01:02.915065685 +0100
@@ -41,6 +41,7 @@ CUPSDOBJS = \
server.o \
statbuf.o \
@ -310,8 +334,8 @@ diff -up cups-1.5.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makef
#
diff -up cups-1.5.0/scheduler/sd-daemon.c.systemd-socket cups-1.5.0/scheduler/sd-daemon.c
--- cups-1.5.0/scheduler/sd-daemon.c.systemd-socket 2011-08-05 15:09:00.796855594 +0100
+++ cups-1.5.0/scheduler/sd-daemon.c 2011-08-05 15:09:00.796855594 +0100
--- cups-1.5.0/scheduler/sd-daemon.c.systemd-socket 2011-09-22 13:01:02.916065667 +0100
+++ cups-1.5.0/scheduler/sd-daemon.c 2011-09-22 13:01:02.917065649 +0100
@@ -0,0 +1,520 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
@ -834,8 +858,8 @@ diff -up cups-1.5.0/scheduler/sd-daemon.c.systemd-socket cups-1.5.0/scheduler/sd
+#endif
+}
diff -up cups-1.5.0/scheduler/sd-daemon.h.systemd-socket cups-1.5.0/scheduler/sd-daemon.h
--- cups-1.5.0/scheduler/sd-daemon.h.systemd-socket 2011-08-05 15:09:00.797855566 +0100
+++ cups-1.5.0/scheduler/sd-daemon.h 2011-08-05 15:09:00.797855566 +0100
--- cups-1.5.0/scheduler/sd-daemon.h.systemd-socket 2011-09-22 13:01:02.917065649 +0100
+++ cups-1.5.0/scheduler/sd-daemon.h 2011-09-22 13:01:02.917065649 +0100
@@ -0,0 +1,277 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+

View File

@ -13,7 +13,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.5.0
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@ -639,6 +639,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/ipptool.1.gz
%changelog
* Thu Sep 22 2011 Tim Waugh <twaugh@redhat.com> 1:1.5.0-9
- Fixed systemd socket activation support (bug #738709, bug #738710).
* Wed Sep 14 2011 Tim Waugh <twaugh@redhat.com> 1:1.5.0-8
- Prevent libcups crash in cups-get-classes patch (bug #736698).