Avoid stale lockfile in dbus notifier (bug #1026949).
Resolves: rhbz#1026949
This commit is contained in:
parent
0a1c56e631
commit
c994ebe40f
103
cups-dbus-notifier.patch
Normal file
103
cups-dbus-notifier.patch
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
diff -up cups-1.5.4/notifier/dbus.c.dbus-notifier cups-1.5.4/notifier/dbus.c
|
||||||
|
--- cups-1.5.4/notifier/dbus.c.dbus-notifier 2013-11-14 17:56:35.585486017 +0000
|
||||||
|
+++ cups-1.5.4/notifier/dbus.c 2013-11-14 17:58:09.964108754 +0000
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
* D-Bus notifier for CUPS.
|
||||||
|
*
|
||||||
|
* Copyright 2008-2011 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.
|
||||||
|
*
|
||||||
|
@@ -156,9 +156,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);
|
||||||
|
|
||||||
|
@@ -250,8 +257,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 */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -628,7 +633,7 @@ main(int argc, /* I - Number of comm
|
||||||
|
if (lock_fd >= 0)
|
||||||
|
{
|
||||||
|
close(lock_fd);
|
||||||
|
- unlink(lock_filename);
|
||||||
|
+ release_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
@@ -636,6 +641,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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@@ -644,7 +669,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 */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -662,8 +688,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
Summary: Common Unix Printing System
|
Summary: Common Unix Printing System
|
||||||
Name: cups
|
Name: cups
|
||||||
Version: 1.5.4
|
Version: 1.5.4
|
||||||
Release: 29%{?dist}
|
Release: 30%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
|
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
|
||||||
@ -86,6 +86,7 @@ Patch49: cups-str4140.patch
|
|||||||
Patch50: cups-str4187.patch
|
Patch50: cups-str4187.patch
|
||||||
Patch51: cups-str4205.patch
|
Patch51: cups-str4205.patch
|
||||||
Patch52: cups-stringpool-setprinterattr.patch
|
Patch52: cups-stringpool-setprinterattr.patch
|
||||||
|
Patch53: cups-dbus-notifier.patch
|
||||||
|
|
||||||
Patch100: cups-lspp.patch
|
Patch100: cups-lspp.patch
|
||||||
|
|
||||||
@ -349,6 +350,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
|
|||||||
%patch51 -p1 -b .str4205
|
%patch51 -p1 -b .str4205
|
||||||
# Prevent stringpool damage leading to memory leaks (bug #974048).
|
# Prevent stringpool damage leading to memory leaks (bug #974048).
|
||||||
%patch52 -p1 -b .stringpool-setprinterattr
|
%patch52 -p1 -b .stringpool-setprinterattr
|
||||||
|
# Avoid stale lockfile in dbus notifier (bug #1026949).
|
||||||
|
%patch53 -p1 -b .dbus-notifier
|
||||||
|
|
||||||
%if %lspp
|
%if %lspp
|
||||||
# LSPP support.
|
# LSPP support.
|
||||||
@ -766,6 +769,9 @@ rm -f %{cups_serverbin}/backend/smb
|
|||||||
%{_mandir}/man5/ipptoolfile.5.gz
|
%{_mandir}/man5/ipptoolfile.5.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 14 2013 Tim Waugh <twaugh@redhat.com> - 1:1.5.4-30
|
||||||
|
- Avoid stale lockfile in dbus notifier (bug #1026949).
|
||||||
|
|
||||||
* Tue Jun 25 2013 Tim Waugh <twaugh@redhat.com> 1:1.5.4-29
|
* Tue Jun 25 2013 Tim Waugh <twaugh@redhat.com> 1:1.5.4-29
|
||||||
- Added usblp quirk for Canon PIXMA MP540 (bug #967873).
|
- Added usblp quirk for Canon PIXMA MP540 (bug #967873).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user