chiark / gitweb /
pager: port fallback pager to use copy_bytes()
authorLennart Poettering <lennart@poettering.net>
Thu, 27 Aug 2015 22:11:49 +0000 (00:11 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:19:06 +0000 (10:19 +0100)
src/shared/pager.c

index b263574..d647403 100644 (file)
 #include "macro.h"
 #include "terminal-util.h"
 #include "signal-util.h"
+#include "copy.h"
 
 static pid_t pager_pid = 0;
 
 noreturn static void pager_fallback(void) {
-        ssize_t n;
-
-        do {
-                n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);
-        } while (n > 0);
+        int r;
 
-        if (n < 0) {
-                log_error_errno(errno, "Internal pager failed: %m");
+        r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (off_t) -1, false);
+        if (r < 0) {
+                log_error_errno(r, "Internal pager failed: %m");
                 _exit(EXIT_FAILURE);
         }