]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp: revert unnecessary FreeBSD workaround
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 30 Oct 2021 17:00:10 +0000 (10:00 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 30 Oct 2021 17:04:54 +0000 (10:04 -0700)
That was a false alarm due to a bug in FreeBSD 9.1 truss;
see Pádraig Brady’s report (Bug#51433#29).
* src/copy.c (lseek_copy, infer_scantype): Don’t bother checking
whether lseek returned -1.  This doesn’t entirely revert the
previous change, as it keeps the code simplification of the
previous change while reverting the check for -1.

src/copy.c

index 1cbc9480c903f59234d38700d2089073a6be4d60..a6523ed975d49c3ddf64d7bd13b0028a55439f48 100644 (file)
@@ -530,7 +530,7 @@ lseek_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
       off_t ext_end = lseek (src_fd, ext_start, SEEK_HOLE);
       if (ext_end < 0)
         {
-          if (! (ext_end == -1 && errno == ENXIO))
+          if (errno != ENXIO)
             goto cannot_lseek;
           ext_end = src_total_size;
           if (ext_end <= ext_start)
@@ -607,7 +607,7 @@ lseek_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
         }
 
       ext_start = lseek (src_fd, dest_pos, SEEK_DATA);
-      if (ext_start < 0 && ! (ext_start == -1 && errno == ENXIO))
+      if (ext_start < 0 && errno != ENXIO)
         goto cannot_lseek;
     }
 
@@ -1093,8 +1093,7 @@ infer_scantype (int fd, struct stat const *sb,
 
 #ifdef SEEK_HOLE
   scan_inference->ext_start = lseek (fd, 0, SEEK_DATA);
-  if (0 <= scan_inference->ext_start
-      || (scan_inference->ext_start == -1 && errno == ENXIO))
+  if (0 <= scan_inference->ext_start || errno == ENXIO)
     return LSEEK_SCANTYPE;
   else if (errno != EINVAL && !is_ENOTSUP (errno))
     return ERROR_SCANTYPE;