]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Fail if the uploaded file could not be stat'ed
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jan 2025 17:32:49 +0000 (17:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Jan 2025 17:32:49 +0000 (17:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/xfer.c

index 9cc8fda275a44a1d8ae0e22449457a1b5dee7736..7949731fe8728383afa4e0601091c56cbfe62d9f 100644 (file)
@@ -674,8 +674,8 @@ int pakfire_xfer_set_input(struct pakfire_xfer* xfer, FILE* f) {
        // Try to find the upload size
        if (fd > 0) {
                r = fstat(fd, &stat);
-               if (r)
-                       return 0;
+               if (r < 0)
+                       return -errno;
 
                // Store the expected filesize
                xfer->expected_size = stat.st_size;