Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
001a2458db | ||
|
|
c3d8587b6b | ||
| 13bccc55f2 | |||
|
|
329377d839 | ||
|
|
70215e395a |
4 changed files with 90 additions and 22 deletions
0
.cvsignore → .gitignore
vendored
0
.cvsignore → .gitignore
vendored
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: upstart
|
||||
# $Id$
|
||||
NAME := upstart
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
80
upstart-utmp.patch
Normal file
80
upstart-utmp.patch
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
diff --git a/init/job.c b/init/job.c
|
||||
index ddf4369..b4a73d8 100644
|
||||
--- a/init/job.c
|
||||
+++ b/init/job.c
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
#include <nih/alloc.h>
|
||||
@@ -1563,6 +1565,8 @@ job_child_reaper (void *data,
|
||||
Job *job;
|
||||
ProcessType process;
|
||||
int failed = FALSE, stop = FALSE, state = TRUE;
|
||||
+ struct utmpx utmp;
|
||||
+ struct utmpx *utmptr;
|
||||
|
||||
nih_assert (data == NULL);
|
||||
nih_assert (pid > 0);
|
||||
@@ -1732,6 +1736,38 @@ job_child_reaper (void *data,
|
||||
job->kill_timer = NULL;
|
||||
}
|
||||
|
||||
+
|
||||
+ /* Find existing utmp entry for the process pid */
|
||||
+ /* clean out an utmp struct. */
|
||||
+ memset(&utmp, 0, sizeof(utmp));
|
||||
+
|
||||
+ setutxent();
|
||||
+ while ((utmptr = getutxent()) != NULL) {
|
||||
+ if (utmptr->ut_pid == job->process[process]->pid) {
|
||||
+ struct timeval tv;
|
||||
+
|
||||
+ /* set type and clean ut_user, ut_host,
|
||||
+ * ut_time as described in utmp(5) */
|
||||
+ utmptr->ut_type = DEAD_PROCESS;
|
||||
+ memset(utmptr->ut_user, 0, UT_NAMESIZE);
|
||||
+ memset(utmptr->ut_host, 0, UT_HOSTSIZE);
|
||||
+ utmptr->ut_time = 0;
|
||||
+ /* Update existing utmp file. */
|
||||
+ pututxline(utmptr);
|
||||
+
|
||||
+ /* set ut_time for log */
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ utmptr->ut_tv.tv_sec = tv.tv_sec;
|
||||
+ utmptr->ut_tv.tv_usec = tv.tv_usec;
|
||||
+ /* Write wtmp entry */
|
||||
+ updwtmpx (_PATH_WTMP, utmptr);
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ endutxent();
|
||||
+
|
||||
+
|
||||
/* Clear the process pid field */
|
||||
job->process[process]->pid = 0;
|
||||
|
||||
diff --git a/init/paths.h b/init/paths.h
|
||||
index ead1ca9..0b8ea6e 100644
|
||||
--- a/init/paths.h
|
||||
+++ b/init/paths.h
|
||||
@@ -92,4 +92,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
+/**
|
||||
+ * _PATH_WTMP:
|
||||
+ *
|
||||
+ * This is the wtmp filename.
|
||||
+ **/
|
||||
+#ifndef _PATH_WTMP
|
||||
+#define _PATH_WTMP "/var/log/wtmp"
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
#endif /* INIT_PATHS_H */
|
||||
11
upstart.spec
11
upstart.spec
|
|
@ -1,6 +1,6 @@
|
|||
Name: upstart
|
||||
Version: 0.3.11
|
||||
Release: 3%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: An event-driven init system
|
||||
|
||||
Group: System Environment/Base
|
||||
|
|
@ -15,6 +15,8 @@ Patch3: upstart-telinit-u.patch
|
|||
Patch4: upstart-initctl-man.patch
|
||||
Patch5: upstart-save-state-across-reexec.patch
|
||||
Patch6: upstart-audit-events.patch
|
||||
# Update utmp and wtmp records when process die
|
||||
Patch7: upstart-utmp.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
|
||||
Provides: SysVinit = 2.86-24, sysvinit = 2.86-24
|
||||
|
|
@ -34,6 +36,7 @@ during shutdown and supervising them while the system is running.
|
|||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
%configure --enable-compat=sysv --sbindir=/sbin --libdir=/%{_lib}
|
||||
|
|
@ -99,6 +102,12 @@ rm -rf %{buildroot}
|
|||
%{_mandir}/man8/telinit.8.gz
|
||||
|
||||
%changelog
|
||||
* Mon Sep 20 2010 Petr Lautrbach <plautrba@redhat.com> 0.3.11-5
|
||||
- Don't rewind utmp file pointer (#632568)
|
||||
|
||||
* Tue Mar 09 2010 Petr Lautrbach <plautrba@redhat.com> 0.3.11-4
|
||||
- Update utmp and wtmp records when process die (#470004)
|
||||
|
||||
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 0.3.11-3
|
||||
- rebuilt with new audit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue