]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid -Wmaybe-uninitialized warning from GCC13
authorPádraig Brady <P@draigBrady.com>
Tue, 21 Feb 2023 16:14:44 +0000 (16:14 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 21 Feb 2023 16:17:53 +0000 (16:17 +0000)
* src/copy.c (infer_scantype): Always set scan_inference.ext_start,
as per commit 6c03e8fb which was inadvertently reverted by d374d32c.

src/copy.c

index 3450e90fc370c108b5d2df5c45540d3acb5718e7..3f54bd561f52e31c759b9854361b6bed92e37e98 100644 (file)
@@ -1052,11 +1052,13 @@ union scan_inference
 };
 
 /* Return how to scan a file with descriptor FD and stat buffer SB.
-   Set *SCAN_INFERENCE if returning LSEEK_SCANTYPE.  */
+   *SCAN_INFERENCE is set to a valid value if returning LSEEK_SCANTYPE.  */
 static enum scantype
 infer_scantype (int fd, struct stat const *sb,
                 union scan_inference *scan_inference)
 {
+  scan_inference->ext_start = -1;  /* avoid -Wmaybe-uninitialized */
+
   if (! (HAVE_STRUCT_STAT_ST_BLOCKS
          && S_ISREG (sb->st_mode)
          && ST_NBLOCKS (*sb) < sb->st_size / ST_NBLOCKSIZE))