diff options
author | Sami Kerola | 2016-08-07 08:27:21 +0200 |
---|---|---|
committer | Sami Kerola | 2016-08-12 22:25:36 +0200 |
commit | 984a60965a0e3cd3253a74c77af916b05381c03d (patch) | |
tree | 8aafe4e47b256298b2ed294dbdcdc50c59c730bf /term-utils/agetty.c | |
parent | tests: mark build-in paths test as optional (diff) | |
download | kernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.tar.gz kernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.tar.xz kernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.zip |
misc: always check setenv(3) return value
At least glibc setenv(3) can fail when system runs out of memory.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'term-utils/agetty.c')
-rw-r--r-- | term-utils/agetty.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c index d5dc0182f..d6cec8f20 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -45,6 +45,7 @@ #include "widechar.h" #include "ttyutils.h" #include "color-names.h" +#include "env.h" #ifdef USE_PLYMOUTH_SUPPORT # include "plymouth-ctrl.h" @@ -1155,7 +1156,8 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) op->term = DEFAULT_STERM; } - setenv("TERM", op->term, 1); + if (setenv("TERM", op->term, 1) != 0) + log_err(_("failed to set the %s environment variable"), "TERM"); } /* Initialize termios settings. */ |