cp: avoid -Wmaybe-uninitialized warning from GCC13

* src/copy.c (infer_scantype): Always set scan_inference.ext_start,
to make the code match the comment.
This commit is contained in:
Jim Meyering committed 2022-06-23 08:31:21 -07:00
1 parent 7e6c39cc02
commit 6c03e8fbb2
1 file changed
+6 -1
+6 -1
View File
@@ -1045,7 +1045,10 @@ infer_scantype (int fd, struct stat const *sb,
if (! (HAVE_STRUCT_STAT_ST_BLOCKS if (! (HAVE_STRUCT_STAT_ST_BLOCKS
&& S_ISREG (sb->st_mode) && S_ISREG (sb->st_mode)
&& ST_NBLOCKS (*sb) < sb->st_size / ST_NBLOCKSIZE)) && ST_NBLOCKS (*sb) < sb->st_size / ST_NBLOCKSIZE))
return PLAIN_SCANTYPE; {
scan_inference->ext_start = -1;
return PLAIN_SCANTYPE;
}
#ifdef SEEK_HOLE #ifdef SEEK_HOLE
scan_inference->ext_start = lseek (fd, 0, SEEK_DATA); scan_inference->ext_start = lseek (fd, 0, SEEK_DATA);
@@ -1053,6 +1056,8 @@ infer_scantype (int fd, struct stat const *sb,
return LSEEK_SCANTYPE; return LSEEK_SCANTYPE;
else if (errno != EINVAL && !is_ENOTSUP (errno)) else if (errno != EINVAL && !is_ENOTSUP (errno))
return ERROR_SCANTYPE; return ERROR_SCANTYPE;
#else
scan_inference->ext_start = -1;
#endif #endif
return ZERO_SCANTYPE; return ZERO_SCANTYPE;