summaryrefslogtreecommitdiffstats
path: root/lib/pager.c
diff options
context:
space:
mode:
authorSami Kerola2016-08-07 08:27:21 +0200
committerSami Kerola2016-08-12 22:25:36 +0200
commit984a60965a0e3cd3253a74c77af916b05381c03d (patch)
tree8aafe4e47b256298b2ed294dbdcdc50c59c730bf /lib/pager.c
parenttests: mark build-in paths test as optional (diff)
downloadkernel-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 'lib/pager.c')
-rw-r--r--lib/pager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pager.c b/lib/pager.c
index 330659eda..e8cf10913 100644
--- a/lib/pager.c
+++ b/lib/pager.c
@@ -138,7 +138,8 @@ static void pager_preexec(void)
FD_SET(STDIN_FILENO, &in);
select(1, &in, NULL, &in, NULL);
- setenv("LESS", "FRSX", 0);
+ if (setenv("LESS", "FRSX", 0) != 0)
+ warn(_("failed to set the %s environment variable"), "LESS");
}
static void wait_for_pager(void)