diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-10 12:25:55 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-10 15:48:14 +0100 |
commit | 063f9f0da9d3833e677d56933182a3f8a39b6d35 (patch) | |
tree | f58477db814d55bbbd0a32cfdf274d3c1249ee54 /src/shared/pager.c | |
parent | sd-event: minor modernization (diff) | |
download | systemd-063f9f0da9d3833e677d56933182a3f8a39b6d35.tar.xz systemd-063f9f0da9d3833e677d56933182a3f8a39b6d35.zip |
basic/env-util: add little helper to call setenv or unsetenv
Diffstat (limited to 'src/shared/pager.c')
-rw-r--r-- | src/shared/pager.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/shared/pager.c b/src/shared/pager.c index cd8a840e57..f689d9f28f 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -189,12 +189,9 @@ int pager_open(PagerFlags flags) { /* We generally always set variables used by less, even if we end up using a different pager. * They shouldn't hurt in any case, and ideally other pagers would look at them too. */ - if (use_secure_mode) - r = setenv("LESSSECURE", "1", 1); - else - r = unsetenv("LESSSECURE"); + r = set_unset_env("LESSSECURE", use_secure_mode ? "1" : NULL, true); if (r < 0) { - log_error_errno(errno, "Failed to adjust environment variable LESSSECURE: %m"); + log_error_errno(r, "Failed to adjust environment variable LESSSECURE: %m"); _exit(EXIT_FAILURE); } |