]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Linux: use statvfs for name_max if available
authorLuke Mewburn <Luke@Mewburn.net>
Sat, 10 Jun 2023 10:21:17 +0000 (11:21 +0100)
committerMartin Matuška <martin@matuska.de>
Thu, 13 Jul 2023 22:12:05 +0000 (00:12 +0200)
If using HAVE_STATVFS, set name_max from svfs.f_namelen
instead of sfs.f_namelen, to be consistent with the
rest of the function.

Noticed by code inspection.

libarchive/archive_read_disk_posix.c

index 5a94ec5d4399fa6848c5161b73806b55000a1075..91f42b16838b8aedb3519e6a77da925a3e99d638 100644 (file)
@@ -1860,7 +1860,11 @@ setup_current_filesystem(struct archive_read_disk *a)
 
 #if defined(USE_READDIR_R)
        /* Set maximum filename length. */
+#if defined(HAVE_STATVFS)
+       t->current_filesystem->name_max = svfs.f_namelen;
+#else
        t->current_filesystem->name_max = sfs.f_namelen;
+#endif
 #endif
        return (ARCHIVE_OK);
 }