summaryrefslogtreecommitdiff
path: root/src/shared/utmp-wtmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/utmp-wtmp.c')
-rw-r--r--src/shared/utmp-wtmp.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index 3494b56908..5ee3d22e71 100644
--- a/src/shared/utmp-wtmp.c
+++ b/src/shared/utmp-wtmp.c
@@ -33,7 +33,7 @@
#include "utmp-wtmp.h"
int utmp_get_runlevel(int *runlevel, int *previous) {
- struct utmpx lookup, *found;
+ struct utmpx *found, lookup = { .ut_type = RUN_LVL };
int r;
const char *e;
@@ -66,9 +66,6 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
setutxent();
- zero(lookup);
- lookup.ut_type = RUN_LVL;
-
if (!(found = getutxid(&lookup)))
r = -errno;
else {
@@ -102,14 +99,12 @@ static void init_timestamp(struct utmpx *store, usec_t t) {
}
static void init_entry(struct utmpx *store, usec_t t) {
- struct utsname uts;
+ struct utsname uts = {};
assert(store);
init_timestamp(store, t);
- zero(uts);
-
if (uname(&uts) >= 0)
strncpy(store->ut_host, uts.release, sizeof(store->ut_host));
@@ -311,7 +306,10 @@ static int write_to_terminal(const char *tty, const char *message) {
while (left > 0) {
ssize_t n;
- struct pollfd pollfd;
+ struct pollfd pollfd = {
+ .fd = fd,
+ .events = POLLOUT,
+ };
usec_t t;
int k;
@@ -320,10 +318,6 @@ static int write_to_terminal(const char *tty, const char *message) {
if (t >= end)
return -ETIME;
- zero(pollfd);
- pollfd.fd = fd;
- pollfd.events = POLLOUT;
-
k = poll(&pollfd, 1, (end - t) / USEC_PER_MSEC);
if (k < 0)
return -errno;