Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Petr Lautrbach
001a2458db don't rewind utmp file pointer (#632568) 2010-09-21 12:13:24 +02:00
Fedora Release Engineering
c3d8587b6b dist-git conversion 2010-07-29 14:46:18 +00:00
13bccc55f2 Update utmp and wtmp records when process die Resolves: #470004 2010-03-10 09:55:40 +00:00
Bill Nottingham
329377d839 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:15:33 +00:00
Jesse Keating
70215e395a Initialize branch F-12 for upstart 2009-09-29 07:13:19 +00:00
4 changed files with 90 additions and 22 deletions

View file

View file

@ -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
View 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 */

View file

@ -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