summaryrefslogtreecommitdiff
path: root/src/shared/pager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-21 10:49:49 +0100
committerGitHub <noreply@github.com>2017-02-21 10:49:49 +0100
commit1ebfd03bd9d3fb8ccb5d17fd741b04914479df28 (patch)
tree4246d7b450bcc1a947fd8c206f2bc61d2f7ed79b /src/shared/pager.c
parentcc7de2ba32562311288480e3a8faba0298852299 (diff)
parent2fa4861ad5a203bff604cac660136834e3b70108 (diff)
Merge pull request #5390 from keszybz/coverity
Clarifications to make coverity happy
Diffstat (limited to 'src/shared/pager.c')
-rw-r--r--src/shared/pager.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/pager.c b/src/shared/pager.c
index af667a83f4..f00ba9e1e7 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -104,7 +104,8 @@ int pager_open(bool no_pager, bool jump_to_end) {
less_opts = "FRSXMK";
if (jump_to_end)
less_opts = strjoina(less_opts, " +G");
- setenv("LESS", less_opts, 1);
+ if (setenv("LESS", less_opts, 1) < 0)
+ _exit(EXIT_FAILURE);
/* Initialize a good charset for less. This is
* particularly important if we output UTF-8
@@ -112,8 +113,9 @@ int pager_open(bool no_pager, bool jump_to_end) {
less_charset = getenv("SYSTEMD_LESSCHARSET");
if (!less_charset && is_locale_utf8())
less_charset = "utf-8";
- if (less_charset)
- setenv("LESSCHARSET", less_charset, 1);
+ if (less_charset &&
+ setenv("LESSCHARSET", less_charset, 1) < 0)
+ _exit(EXIT_FAILURE);
/* Make sure the pager goes away when the parent dies */
if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)