pager: port fallback pager to use copy_bytes()
authorLennart Poettering <lennart@poettering.net>
Thu, 27 Aug 2015 22:11:49 +0000 (00:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 28 Aug 2015 00:05:51 +0000 (02:05 +0200)
src/shared/pager.c

index 13f03e7..a5454e3 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);
         }