crash-pipe: Fix write the coredump to the file 99/180399/1
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Mon, 28 May 2018 10:46:32 +0000 (12:46 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Tue, 29 May 2018 06:35:30 +0000 (08:35 +0200)
splice len parameter is size_t type. On some architectures (eg. aarch64)
splice returned EINVAL when the parameter len was ssize_t variable and
was equal SSIZE_MAX

Change-Id: Id84038662dcd2969a33af1e276a3b4500a780f29

src/crash-pipe/crash-pipe.c

index d04037b..0a8cb4d 100644 (file)
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <limits.h>
+#include <stdint.h>
 
 enum {
        OPT_HELP,
@@ -74,7 +75,7 @@ static int copy_fd_splice(int in, int out)
        ssize_t s;
        _Bool copied_data = 0;
 
-       const ssize_t max_splice = SSIZE_MAX;
+       const size_t max_splice = SIZE_MAX;
 
        do {
                s = splice(in, NULL, out, NULL, max_splice, SPLICE_F_MOVE);