forked from pool/systemd
e7c96ab7f3
- Add patch 0001-bnc888612-logind-polkit-acpi.patch from Frederic to solve bnc#888612 - AUDIT-0: Power button press at gdm login should not prompt for credentials - Add upstream bugfix patches 0001-journal-Do-not-count-on-the-compiler-initializing-fo.patch 0002-include-fcntl.h-rather-than-sys-fcntl.h.patch 0003-mount-order-options-before-other-arguments-to-mount.patch 0004-shared-wtmp-utmp-don-t-clear-store_wtmp-in-utmp_put_.patch 0005-shared-label.h-add-missing-stdio.h-include.patch 0006-shared-sparse-endian.h-add-missing-byteswap.h-includ.patch 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patch 1080-udevd-parse_argv-warn-if-argumens-are-invalid.patch 1081-udevd-check-return-of-various-functions.patch 1082-udevadm-hwdb-check-return-value-of-fseeko.patch 1083-udev-node-warn-if-chmod-chown-fails.patch 1084-udev-ctrl-log-if-setting-SO_PASSCRED-fails.patch 1085-udev-fix-typos.patch 1086-udevd-don-t-fail-if-run-udev-exists.patch - Add upstream bugfix patches 0001-core-fix-resource-leak-in-manager_environment_add.patch 0002-util-remove-a-unnecessary-check.patch 0003-udev-event-explicitly-don-t-read-from-invalid-fd.patch 0004-shared-conf-parser.patch 0005-logind-fix-typo.patch 0006-systemctl-fix-resource-leak-CID-1237747.patch 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patc OBS-URL: https://build.opensuse.org/request/show/250254 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=207
107 lines
3.3 KiB
Diff
107 lines
3.3 KiB
Diff
From 863f3ce0d050f005839f6aa41fe7bac5478a7b5e Mon Sep 17 00:00:00 2001
|
|
From: Tom Gundersen <teg@jklm.no>
|
|
Date: Fri, 19 Sep 2014 08:03:31 +0200
|
|
Subject: [PATCH] shared: wtmp-utmp - don't clear store_wtmp in
|
|
utmp_put_dead_process()
|
|
|
|
Also modernize a few other things and add comments to explain CID #1237503
|
|
and CID #1237504.
|
|
---
|
|
src/shared/utmp-wtmp.c | 28 ++++++++++++++--------------
|
|
1 file changed, 14 insertions(+), 14 deletions(-)
|
|
|
|
diff --git src/shared/utmp-wtmp.c src/shared/utmp-wtmp.c
|
|
index 30a0c03..31f13ec 100644
|
|
--- src/shared/utmp-wtmp.c
|
|
+++ src/shared/utmp-wtmp.c
|
|
@@ -92,8 +92,6 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
|
|
static void init_timestamp(struct utmpx *store, usec_t t) {
|
|
assert(store);
|
|
|
|
- zero(*store);
|
|
-
|
|
if (t <= 0)
|
|
t = now(CLOCK_REALTIME);
|
|
|
|
@@ -143,7 +141,7 @@ static int write_entry_wtmp(const struct utmpx *store) {
|
|
assert(store);
|
|
|
|
/* wtmp is a simple append-only file where each entry is
|
|
- simply appended to * the end; i.e. basically a log. */
|
|
+ simply appended to the end; i.e. basically a log. */
|
|
|
|
errno = 0;
|
|
updwtmpx(_PATH_WTMPX, store);
|
|
@@ -172,7 +170,7 @@ static int write_entry_both(const struct utmpx *store) {
|
|
}
|
|
|
|
int utmp_put_shutdown(void) {
|
|
- struct utmpx store;
|
|
+ struct utmpx store = {};
|
|
|
|
init_entry(&store, 0);
|
|
|
|
@@ -183,7 +181,7 @@ int utmp_put_shutdown(void) {
|
|
}
|
|
|
|
int utmp_put_reboot(usec_t t) {
|
|
- struct utmpx store;
|
|
+ struct utmpx store = {};
|
|
|
|
init_entry(&store, t);
|
|
|
|
@@ -206,16 +204,17 @@ _pure_ static const char *sanitize_id(const char *id) {
|
|
}
|
|
|
|
int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line) {
|
|
- struct utmpx store;
|
|
+ struct utmpx store = {
|
|
+ .ut_type = INIT_PROCESS,
|
|
+ .ut_pid = pid,
|
|
+ .ut_session = sid,
|
|
+ };
|
|
|
|
assert(id);
|
|
|
|
init_timestamp(&store, 0);
|
|
|
|
- store.ut_type = INIT_PROCESS;
|
|
- store.ut_pid = pid;
|
|
- store.ut_session = sid;
|
|
-
|
|
+ /* ut_id needs only be nul-terminated if it is shorter than sizeof(ut_id) */
|
|
strncpy(store.ut_id, sanitize_id(id), sizeof(store.ut_id));
|
|
|
|
if (line)
|
|
@@ -225,14 +224,15 @@ int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line
|
|
}
|
|
|
|
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
|
|
- struct utmpx lookup, store, store_wtmp, *found;
|
|
+ struct utmpx lookup = {
|
|
+ .ut_type = INIT_PROCESS /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */
|
|
+ }, store, store_wtmp, *found;
|
|
|
|
assert(id);
|
|
|
|
setutxent();
|
|
|
|
- zero(lookup);
|
|
- lookup.ut_type = INIT_PROCESS; /* looks for DEAD_PROCESS, LOGIN_PROCESS, USER_PROCESS, too */
|
|
+ /* ut_id needs only be nul-terminated if it is shorter than sizeof(ut_id) */
|
|
strncpy(lookup.ut_id, sanitize_id(id), sizeof(lookup.ut_id));
|
|
|
|
found = getutxid(&lookup);
|
|
@@ -260,7 +260,7 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
|
|
|
|
|
|
int utmp_put_runlevel(int runlevel, int previous) {
|
|
- struct utmpx store;
|
|
+ struct utmpx store = {};
|
|
int r;
|
|
|
|
assert(runlevel > 0);
|
|
--
|
|
1.7.9.2
|
|
|