rpms/upstart/devel upstart-force-on-shutdown-reboot.patch, NONE, 1.1 upstart.spec, 1.3, 1.4

Casey Dahlin (sadmac) fedora-extras-commits at redhat.com
Sat Feb 16 03:54:07 UTC 2008


Author: sadmac

Update of /cvs/pkgs/rpms/upstart/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29001/devel

Modified Files:
	upstart.spec 
Added Files:
	upstart-force-on-shutdown-reboot.patch 
Log Message:
Patch for loop on shutdown bug.


upstart-force-on-shutdown-reboot.patch:

--- NEW FILE upstart-force-on-shutdown-reboot.patch ---
diff -up upstart-0.3.9/compat/sysv/reboot.c.foo upstart-0.3.9/compat/sysv/reboot.c
--- upstart-0.3.9/compat/sysv/reboot.c.foo	2008-02-15 16:52:30.000000000 -0500
+++ upstart-0.3.9/compat/sysv/reboot.c	2008-02-15 17:47:37.000000000 -0500
@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <utmp.h>
 
 #include <linux/if.h>
 #include <linux/hdreg.h>
@@ -158,12 +159,31 @@ static NihOption options[] = {
 	NIH_OPTION_LAST
 };
 
+static char get_runlevel(void)
+{
+	struct utmp utmp, *lvl;
+	char *rl, runlevel = 0;
+
+	if ((rl = getenv("RUNLEVEL")) != NULL)
+		return *rl;
+
+	memset(&utmp, 0, sizeof(utmp));
+	utmp.ut_type = RUN_LVL;
+	setutent();
+	lvl = getutid(&utmp);
+	if (lvl)
+		runlevel = lvl->ut_pid % 256;
+	endutent();
+	return runlevel;	
+}
+
 
 int
 main (int   argc,
       char *argv[])
 {
 	char **args;
+	char level;
 	int    mode;
 
 	nih_main_init (argv[0]);
@@ -211,6 +231,12 @@ main (int   argc,
 
 	if (exit_only)
 		exit (0);
+		
+	level = get_runlevel();
+	if (level) {
+		if (level == '0' || level == '6')
+			force = TRUE;
+	}
 
 	/* Normally we just exec shutdown, which notifies everyone and
 	 * signals init.


Index: upstart.spec
===================================================================
RCS file: /cvs/pkgs/rpms/upstart/devel/upstart.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- upstart.spec	7 Feb 2008 05:03:44 -0000	1.3
+++ upstart.spec	16 Feb 2008 03:53:32 -0000	1.4
@@ -1,6 +1,6 @@
 Name:           upstart
 Version:        0.3.9
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        An event-driven init system
 
 Group:          System Environment/Base
@@ -8,6 +8,7 @@
 URL:            http://upstart.ubuntu.com
 Source0:        http://upstart.ubuntu.com/download/0.3/upstart-%{version}.tar.bz2
 Patch0:         upstart-gcc43.patch
+Patch1:         upstart-force-on-shutdown-reboot.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  gettext
@@ -20,6 +21,7 @@
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %configure --enable-compat=sysv --sbindir=/sbin --libdir=/%{_lib}
@@ -81,6 +83,9 @@
 %{_mandir}/man8/telinit.8.gz
 
 %changelog
+* Fri Feb 15 2008 Casey Dahlin <cjdahlin at ncsu.edu> - 0.3.9-5
+- Added patch to imply --force on runlevels 0 and 6
+
 * Wed Feb 06 2008 Casey Dahlin <cjdahlin at ncsu.edu> - 0.3.9-4
 - Patched for GCC 4.3
 




More information about the fedora-extras-commits mailing list