-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
***/
#include <errno.h>
-#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <unistd.h>
#include "sd-messages.h"
-#include "logind-seat.h"
+
+#include "alloc-util.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "formats-util.h"
#include "logind-acl.h"
-#include "util.h"
+#include "logind-seat.h"
#include "mkdir.h"
-#include "formats-util.h"
+#include "parse-util.h"
+#include "stdio-util.h"
+#include "string-util.h"
#include "terminal-util.h"
+#include "util.h"
Seat *seat_new(Manager *m, const char *id) {
Seat *s;
return NULL;
s->state_file = strappend("/run/systemd/seats/", id);
- if (!s->state_file) {
- free(s);
- return NULL;
- }
+ if (!s->state_file)
+ return mfree(s);
s->id = basename(s->state_file);
s->manager = m;
if (hashmap_put(m->seats, s->id, s) < 0) {
free(s->state_file);
- free(s);
- return NULL;
+ return mfree(s);
}
return s;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static int vt_allocate(unsigned int vtnr) {
char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
- snprintf(p, sizeof(p), "/dev/tty%u", vtnr);
+ xsprintf(p, "/dev/tty%u", vtnr);
fd = open_terminal(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
return -errno;
}
r = seat_set_active(s, new_active);
-
-/// elogind does not spawn autovt
-#if 0
+#if 0 /// elogind does not spawn autovt
manager_spawn_autovt(s->manager, vtnr);
#endif // 0
NULL);
/* Initialize VT magic stuff */
-/// elogind does not support autospawning vts
-#if 0
+#if 0 /// elogind does not support autospawning vts
seat_preallocate_vts(s);
#endif // 0