chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
assigning stdout and stderr is not allowed
[elogind.git]
/
src
/
shared
/
pager.c
diff --git
a/src/shared/pager.c
b/src/shared/pager.c
index 82f9294162a680d5f5ab46c3d7b79b35093c591b..9a097a16514eea53be7a0bd640a47bb2ac2d3845 100644
(file)
--- 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");
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
/* 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";
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)
/* Make sure the pager goes away when the parent dies */
if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)
@@
-159,13
+161,6
@@
void pager_close(void) {
return;
/* Inform pager that we are done */
return;
/* Inform pager that we are done */
-#ifdef __GLIBC__
- stdout = safe_fclose(stdout);
- stderr = safe_fclose(stderr);
-#else
- safe_fclose(stdout);
- safe_fclose(stderr);
-#endif // __GLIBC__
(void) kill(pager_pid, SIGCONT);
(void) wait_for_terminate(pager_pid, NULL);
(void) kill(pager_pid, SIGCONT);
(void) wait_for_terminate(pager_pid, NULL);