chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "logind: really handle *KeyIgnoreInhibited options in logind.conf"
[elogind.git]
/
src
/
login
/
logind-seat.c
diff --git
a/src/login/logind-seat.c
b/src/login/logind-seat.c
index 495ec50be06d21e1da86505f5c394b01c78b53af..ae42811dea4d12dcc3242fb5361cab4e09525424 100644
(file)
--- a/
src/login/logind-seat.c
+++ b/
src/login/logind-seat.c
@@
-1,5
+1,3
@@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-20,17
+18,24
@@
***/
#include <errno.h>
***/
#include <errno.h>
-#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <fcntl.h>
#include <string.h>
+#include <unistd.h>
#include "sd-messages.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 "logind-acl.h"
-#include "
util
.h"
+#include "
logind-seat
.h"
#include "mkdir.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 "terminal-util.h"
+#include "util.h"
Seat *seat_new(Manager *m, const char *id) {
Seat *s;
Seat *seat_new(Manager *m, const char *id) {
Seat *s;
@@
-93,11
+98,11
@@
int seat_save(Seat *s) {
r = mkdir_safe_label("/run/systemd/seats", 0755, 0, 0);
if (r < 0)
r = mkdir_safe_label("/run/systemd/seats", 0755, 0, 0);
if (r < 0)
- goto f
inish
;
+ goto f
ail
;
r = fopen_temporary(s->state_file, &f, &temp_path);
if (r < 0)
r = fopen_temporary(s->state_file, &f, &temp_path);
if (r < 0)
- goto f
inish
;
+ goto f
ail
;
fchmod(fileno(f), 0644);
fchmod(fileno(f), 0644);
@@
-141,19
+146,24
@@
int seat_save(Seat *s) {
i->sessions_by_seat_next ? ' ' : '\n');
}
i->sessions_by_seat_next ? ' ' : '\n');
}
- fflush(f);
+ r = fflush_and_check(f);
+ if (r < 0)
+ goto fail;
- if (
ferror(f) ||
rename(temp_path, s->state_file) < 0) {
+ if (rename(temp_path, s->state_file) < 0) {
r = -errno;
r = -errno;
- unlink(s->state_file);
- unlink(temp_path);
+ goto fail;
}
}
-finish:
- if (r < 0)
- log_error_errno(r, "Failed to save seat data %s: %m", s->state_file);
+ return 0;
- return r;
+fail:
+ (void) unlink(s->state_file);
+
+ if (temp_path)
+ (void) unlink(temp_path);
+
+ return log_error_errno(r, "Failed to save seat data %s: %m", s->state_file);
}
int seat_load(Seat *s) {
}
int seat_load(Seat *s) {
@@
-164,13
+174,14
@@
int seat_load(Seat *s) {
return 0;
}
return 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);
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;
fd = open_terminal(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
return -errno;
@@
-205,6
+216,7
@@
int seat_preallocate_vts(Seat *s) {
return r;
}
return r;
}
+#endif // 0
int seat_apply_acls(Seat *s, Session *old_active) {
int r;
int seat_apply_acls(Seat *s, Session *old_active) {
int r;
@@
-356,7
+368,9
@@
int seat_active_vt_changed(Seat *s, unsigned int vtnr) {
}
r = seat_set_active(s, new_active);
}
r = seat_set_active(s, new_active);
+#if 0 /// elogind does not spawn autovt
manager_spawn_autovt(s->manager, vtnr);
manager_spawn_autovt(s->manager, vtnr);
+#endif // 0
return r;
}
return r;
}
@@
-415,7
+429,9
@@
int seat_start(Seat *s) {
NULL);
/* Initialize VT magic stuff */
NULL);
/* Initialize VT magic stuff */
+#if 0 /// elogind does not support autospawning vts
seat_preallocate_vts(s);
seat_preallocate_vts(s);
+#endif // 0
/* Read current VT */
seat_read_active_vt(s);
/* Read current VT */
seat_read_active_vt(s);