]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/pager.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / shared / pager.c
index 4d7b02c63c4ae08b9001472a3bcbd54c838d7bab..39997278f1fdea8be55d53ec17941d6d2369a359 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -80,14 +81,15 @@ int pager_open(bool no_pager, bool jump_to_end) {
         if (pager && STR_IN_SET(pager, "", "cat"))
                 return 0;
 
-        /* Determine and cache number of columns before we spawn the
-         * pager so that we get the value from the actual tty */
+        /* Determine and cache number of columns/lines before we spawn the pager so that we get the value from the
+         * actual tty */
         (void) columns();
+        (void) lines();
 
-        if (pipe(fd) < 0)
+        if (pipe2(fd, O_CLOEXEC) < 0)
                 return log_error_errno(errno, "Failed to create pager pipe: %m");
 
-        parent_pid = getpid();
+        parent_pid = getpid_cached();
 
         pager_pid = fork();
         if (pager_pid < 0)