chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
__thread --> thread_local for C11 compat
[elogind.git]
/
src
/
login
/
logind-seat.c
diff --git
a/src/login/logind-seat.c
b/src/login/logind-seat.c
index ca0e8d7fcfdd0fc2ee2d24938c2845bf5c7596a9..c73860478d1619dd71bdfd897fd0d9880ffa2a0a 100644
(file)
--- a/
src/login/logind-seat.c
+++ b/
src/login/logind-seat.c
@@
-51,7
+51,7
@@
Seat *seat_new(Manager *m, const char *id) {
return NULL;
}
return NULL;
}
- s->id =
path_get_file_
name(s->state_file);
+ s->id =
base
name(s->state_file);
s->manager = m;
if (hashmap_put(m->seats, s->id, s) < 0) {
s->manager = m;
if (hashmap_put(m->seats, s->id, s) < 0) {
@@
-166,13
+166,13
@@
int seat_load(Seat *s) {
return 0;
}
return 0;
}
-static int vt_allocate(int vtnr) {
+static int vt_allocate(
unsigned
int vtnr) {
_cleanup_free_ char *p = NULL;
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
_cleanup_free_ char *p = NULL;
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
- if (asprintf(&p, "/dev/tty%
i
", vtnr) < 0)
+ if (asprintf(&p, "/dev/tty%
u
", vtnr) < 0)
return -ENOMEM;
fd = open_terminal(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
return -ENOMEM;
fd = open_terminal(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
@@
-270,7
+270,7
@@
int seat_set_active(Seat *s, Session *session) {
return 0;
}
return 0;
}
-int seat_active_vt_changed(Seat *s, int vtnr) {
+int seat_active_vt_changed(Seat *s,
unsigned
int vtnr) {
Session *i, *new_active = NULL;
int r;
Session *i, *new_active = NULL;
int r;
@@
-280,7
+280,7
@@
int seat_active_vt_changed(Seat *s, int vtnr) {
if (!seat_has_vts(s))
return -EINVAL;
if (!seat_has_vts(s))
return -EINVAL;
- log_debug("VT changed to %
i
", vtnr);
+ log_debug("VT changed to %
u
", vtnr);
LIST_FOREACH(sessions_by_seat, i, s->sessions)
if (i->vtnr == vtnr) {
LIST_FOREACH(sessions_by_seat, i, s->sessions)
if (i->vtnr == vtnr) {
@@
-297,7
+297,8
@@
int seat_active_vt_changed(Seat *s, int vtnr) {
int seat_read_active_vt(Seat *s) {
char t[64];
ssize_t k;
int seat_read_active_vt(Seat *s) {
char t[64];
ssize_t k;
- int r, vtnr;
+ unsigned int vtnr;
+ int r;
assert(s);
assert(s);
@@
-320,13
+321,13
@@
int seat_read_active_vt(Seat *s) {
return -EIO;
}
return -EIO;
}
- r = safe_ato
i
(t+3, &vtnr);
+ r = safe_ato
u
(t+3, &vtnr);
if (r < 0) {
log_error("Failed to parse VT number %s", t+3);
return r;
}
if (r < 0) {
log_error("Failed to parse VT number %s", t+3);
return r;
}
- if (
vtnr <= 0
) {
+ if (
!vtnr
) {
log_error("VT number invalid: %s", t+3);
return -EIO;
}
log_error("VT number invalid: %s", t+3);
return -EIO;
}
@@
-407,6
+408,9
@@
int seat_attach_session(Seat *s, Session *session) {
assert(session);
assert(!session->seat);
assert(session);
assert(!session->seat);
+ if (!seat_has_vts(s) != !session->vtnr)
+ return -EINVAL;
+
session->seat = s;
LIST_PREPEND(sessions_by_seat, s->sessions, session);
session->seat = s;
LIST_PREPEND(sessions_by_seat, s->sessions, session);