X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-seat.c;h=3f5efdc8ea706f8195b463163f838a5d4d34fd75;hb=f39d4a08e746e703d562076a0f622eb91dbdcd3e;hp=96cf08e3b2f1b34fc6d2dc7d0ef2b44a85a94802;hpb=3e6b205f81e743c7354ccbc69eb45afbdbebe2dc;p=elogind.git diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 96cf08e3b..3f5efdc8e 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;