rpms/radvd/devel radvd-1.1-stale_pid.patch, NONE, 1.1 radvd.spec, 1.43, 1.44
Martin Nagy (mnagy)
fedora-extras-commits at redhat.com
Fri Apr 11 09:25:43 UTC 2008
Author: mnagy
Update of /cvs/extras/rpms/radvd/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11749
Modified Files:
radvd.spec
Added Files:
radvd-1.1-stale_pid.patch
Log Message:
* Fri Apr 11 2008 Martin Nagy <mnagy at redhat.com> - 1.1-3
- remove stale pid file on start
radvd-1.1-stale_pid.patch:
--- NEW FILE radvd-1.1-stale_pid.patch ---
diff -up radvd-1.1/radvd.c.stale_pid radvd-1.1/radvd.c
--- radvd-1.1/radvd.c.stale_pid 2008-01-24 11:03:17.000000000 +0100
+++ radvd-1.1/radvd.c 2008-04-04 15:10:52.000000000 +0200
@@ -70,6 +70,7 @@ main(int argc, char *argv[])
{
unsigned char msg[MSG_SIZE];
char pidstr[16];
+ int ret;
int c, log_method;
char *logfile, *pidfile;
sigset_t oset, nset;
@@ -230,10 +231,29 @@ main(int argc, char *argv[])
exit(1);
}
- /* FIXME: not atomic if pidfile is on an NFS mounted volume */
- if ((fd = open(pidfile, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
+ if ((fd = open(pidfile, O_RDONLY, 0)) > 0)
{
- flog(LOG_ERR, "radvd pid file already exists or cannot be created, terminating: %s", strerror(errno));
+ ret = read(fd, pidstr, sizeof(pidstr) - 1);
+ if (ret < 0)
+ {
+ flog(LOG_ERR, "cannot read radvd pid file, terminating: %s", strerror(errno));
+ exit(1);
+ }
+ pidstr[ret] = '\0';
+ if (!kill(atol(pidstr), 0))
+ {
+ flog(LOG_ERR, "radvd already running, terminating.");
+ exit(1);
+ }
+ close(fd);
+ fd = open(pidfile, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ }
+ else /* FIXME: not atomic if pidfile is on an NFS mounted volume */
+ fd = open(pidfile, O_CREAT|O_EXCL|O_WRONLY, 0644);
+
+ if (fd < 0)
+ {
+ flog(LOG_ERR, "cannot create radvd pid file, terminating: %s", strerror(errno));
exit(1);
}
Index: radvd.spec
===================================================================
RCS file: /cvs/extras/rpms/radvd/devel/radvd.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- radvd.spec 25 Feb 2008 11:00:07 -0000 1.43
+++ radvd.spec 11 Apr 2008 09:25:01 -0000 1.44
@@ -5,7 +5,7 @@
Summary: A Router Advertisement daemon
Name: radvd
Version: 1.1
-Release: 2%{?dist}
+Release: 3%{?dist}
# The code includes the advertising clause, so it's GPL-incompatible
License: BSD-style
Group: System Environment/Daemons
@@ -19,6 +19,7 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: radvd-1.1-string_cmp.patch
+Patch1: radvd-1.1-stale_pid.patch
%description
radvd is the router advertisement daemon for IPv6. It listens to router
@@ -33,7 +34,8 @@
%prep
%setup -q
-%patch0 -p1 -b string_cmp
+%patch0 -p1 -b .string_cmp
+%patch1 -p1 -b .stale_pid
%build
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIE"
@@ -95,6 +97,9 @@
%{_sbindir}/radvdump
%changelog
+* Fri Apr 11 2008 Martin Nagy <mnagy at redhat.com> - 1.1-3
+- remove stale pid file on start
+
* Mon Feb 25 2008 Martin Nagy <mnagy at redhat.com> - 1.1-2
- fix up string comparison in init script (#427047)
More information about the fedora-extras-commits
mailing list