#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;
setutxent();
- zero(lookup);
- lookup.ut_type = RUN_LVL;
-
if (!(found = getutxid(&lookup)))
r = -errno;
else {
}
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));
#define TIMEOUT_MSEC 50
static int write_to_terminal(const char *tty, const char *message) {
- int _cleanup_close_ fd = -1;
+ _cleanup_close_ int fd = -1;
const char *p;
size_t left;
usec_t end;
while (left > 0) {
ssize_t n;
- struct pollfd pollfd;
+ struct pollfd pollfd = {
+ .fd = fd,
+ .events = POLLOUT,
+ };
usec_t t;
int k;
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;