summaryrefslogtreecommitdiff
path: root/src/login/logind-seat.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-02 23:58:16 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-03-04 10:02:09 -0500
commit61376f96a98291b5421bfd79a15ca4db50c2a3fe (patch)
treed271e8833fe9f87e09f48f46ce2418bec6ce6a76 /src/login/logind-seat.c
parent21491585780b71010b7ee2138fa394680b2de340 (diff)
logind: small simplifications
Diffstat (limited to 'src/login/logind-seat.c')
-rw-r--r--src/login/logind-seat.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 96cf08e3b2..3f5efdc8ea 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -168,14 +168,12 @@ int seat_load(Seat *s) {
}
static int vt_allocate(unsigned int vtnr) {
- _cleanup_free_ char *p = NULL;
+ char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
- if (asprintf(&p, "/dev/tty%u", vtnr) < 0)
- return -ENOMEM;
-
+ snprintf(p, sizeof(p), "/dev/tty%u", vtnr);
fd = open_terminal(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
return -errno;