]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
return ((int)r); is not part of if statement due to missing brackets (#1930)
authorAtariDreams <83477269+AtariDreams@users.noreply.github.com>
Sat, 22 Jul 2023 02:30:44 +0000 (22:30 -0400)
committerGitHub <noreply@github.com>
Sat, 22 Jul 2023 02:30:44 +0000 (19:30 -0700)
This is problematic because we need to return if an error occurs, and
because we are letting a continue to be evaluated even though it is
closed.

libarchive/archive_write_disk_posix.c

index f28aaefdce5f1c5a87593f09a6c73a796f379329..c8c2e1058c9115dcc362474ee9dffdca026c5d74 100644 (file)
@@ -1611,12 +1611,12 @@ hfs_write_data_block(struct archive_write_disk *a, const char *buff,
                            "Seek failed");
                        return (ARCHIVE_FATAL);
                } else if (a->offset > a->fd_offset) {
-                       int64_t skip = a->offset - a->fd_offset;
+                       uint64_t skip = a->offset - a->fd_offset;
                        char nullblock[1024];
 
                        memset(nullblock, 0, sizeof(nullblock));
                        while (skip > 0) {
-                               if (skip > (int64_t)sizeof(nullblock))
+                               if (skip > sizeof(nullblock))
                                        bytes_written = hfs_write_decmpfs_block(
                                            a, nullblock, sizeof(nullblock));
                                else
@@ -1731,9 +1731,10 @@ _archive_write_disk_finish_entry(struct archive *_a)
                        else
                                r = hfs_write_data_block(
                                    a, null_d, a->file_remaining_bytes);
-                       if (r < 0)
+                       if (r < 0) {
                                close_file_descriptor(a);
                                return ((int)r);
+                       }
                }
 #endif
        } else {