Merge branch 'f19' into f20

Conflicts:
	cups.spec
This commit is contained in:
Tim Waugh 2013-11-14 18:14:23 +00:00
commit 2568000642
2 changed files with 110 additions and 1 deletions

103
cups-dbus-notifier.patch Normal file
View File

@ -0,0 +1,103 @@
diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
--- cups-1.7.0/notifier/dbus.c.dbus-notifier 2013-11-14 18:10:31.745121435 +0000
+++ cups-1.7.0/notifier/dbus.c 2013-11-14 18:10:53.997227718 +0000
@@ -4,7 +4,7 @@
* D-Bus notifier for CUPS.
*
* Copyright 2008-2012 by Apple Inc.
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011, 2013 Red Hat, Inc.
* Copyright (C) 2007 Tim Waugh <twaugh@redhat.com>
* Copyright 1997-2005 by Easy Software Products.
*
@@ -157,9 +157,16 @@ enum
/*
+ * Global variables...
+ */
+
+static char lock_filename[1024]; /* Lock filename */
+
+/*
* Local functions...
*/
+static void release_lock(void);
static int acquire_lock(int *fd, char *lockfile, size_t locksize);
static const char *validate_utf8(const char *str);
@@ -251,8 +258,6 @@ main(int argc, /* I - Number of comm
DBusMessage *message; /* Message to send */
DBusMessageIter iter; /* Iterator for message data */
int lock_fd = -1; /* Lock file descriptor */
- char lock_filename[1024];
- /* Lock filename */
/*
@@ -653,7 +658,7 @@ main(int argc, /* I - Number of comm
if (lock_fd >= 0)
{
close(lock_fd);
- unlink(lock_filename);
+ release_lock();
}
return (0);
@@ -661,6 +666,26 @@ main(int argc, /* I - Number of comm
/*
+ * 'release_lock()' - Release the singleton lock.
+ */
+
+static void
+release_lock(void)
+{
+ unlink(lock_filename);
+}
+
+
+/*
+ * 'handle_sigterm()' - Handle SIGTERM signal.
+ */
+static void
+handle_sigterm(int signum)
+{
+ release_lock();
+}
+
+/*
* 'acquire_lock()' - Acquire a lock so we only have a single notifier running.
*/
@@ -669,7 +694,8 @@ acquire_lock(int *fd, /* O - Lock fi
char *lockfile, /* I - Lock filename buffer */
size_t locksize) /* I - Size of filename buffer */
{
- const char *tmpdir; /* Temporary directory */
+ const char *tmpdir; /* Temporary directory */
+ struct sigaction action; /* POSIX sigaction data */
/*
@@ -687,8 +713,16 @@ acquire_lock(int *fd, /* O - Lock fi
if ((*fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
return (-1);
- else
- return (0);
+
+ /*
+ * Set a SIGTERM handler to make sure we release the lock if the
+ * scheduler decides to stop us.
+ */
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = handle_sigterm;
+ sigaction(SIGTERM, &action, NULL);
+
+ return (0);
}
#else /* !HAVE_DBUS */
int

View File

@ -11,7 +11,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 1.7.0
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2
Group: System Environment/Daemons
Url: http://www.cups.org/
@ -71,6 +71,7 @@ Patch43: cups-final-content-type.patch
Patch44: cups-jobhistory.patch
Patch45: cups-journal.patch
Patch46: cups-synconclose.patch
Patch47: cups-dbus-notifier.patch
Patch100: cups-lspp.patch
@ -272,6 +273,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch45 -p1 -b .journal
# Set the default for SyncOnClose to Yes.
%patch46 -p1 -b .synconclose
# Avoid stale lockfile in dbus notifier (bug #1026949).
%patch47 -p1 -b .dbus-notifier
%if %lspp
# LSPP support.
@ -652,6 +655,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
* Thu Nov 14 2013 Tim Waugh <twaugh@redhat.com> - 1:1.7.0-5
- Avoid stale lockfile in dbus notifier (bug #1026949).
* Mon Nov 4 2013 Tim Waugh <twaugh@redhat.com> - 1:1.7.0-4
- Adjusted commented out default for SyncOnClose in cups-files.conf.