login.c: fix several `-Werror=format-truncation`

Signed-off-by: Roosembert Palacios <roosembert.palacios@epfl.ch>
This commit is contained in:
Roosembert Palacios 2019-10-26 12:58:14 +02:00
parent 28b094febb
commit 8c6f0526ae
No known key found for this signature in database
GPG Key ID: CAAAECE5C2242BB7
1 changed files with 2 additions and 2 deletions

View File

@ -466,7 +466,7 @@ void auth(
struct pam_conv conv = {login_conv, creds};
struct pam_handle* handle;
char tty_id [3];
snprintf(tty_id, 3, "%d", config.tty);
snprintf(tty_id, 3, "%d", (unsigned int)config.tty % 99);
ok = pam_start(config.service_name, NULL, &conv, &handle);
@ -578,7 +578,7 @@ void auth(
char vt[5];
snprintf(display_name, 3, ":%d", display_id);
snprintf(vt, 5, "vt%d", config.tty);
snprintf(vt, 5, "vt%d", (unsigned int)config.tty % 99);
// set env
env_init(pwd, display_name);