Module Name:    src
Committed By:   christos
Date:           Mon Jan 15 17:41:06 UTC 2024

Modified Files:
        src/bin/cp: utils.c

Log Message:
PR/57857: Ricardo Branco: Always copy regular files, even if they appear to
be zero-sized.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/cp/utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/cp/utils.c
diff -u src/bin/cp/utils.c:1.49 src/bin/cp/utils.c:1.50
--- src/bin/cp/utils.c:1.49	Sun May 17 19:34:11 2020
+++ src/bin/cp/utils.c	Mon Jan 15 12:41:06 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: utils.c,v 1.49 2020/05/17 23:34:11 christos Exp $ */
+/* $NetBSD: utils.c,v 1.50 2024/01/15 17:41:06 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)utils.c	8.3 (Berkeley) 4/1/94";
 #else
-__RCSID("$NetBSD: utils.c,v 1.49 2020/05/17 23:34:11 christos Exp $");
+__RCSID("$NetBSD: utils.c,v 1.50 2024/01/15 17:41:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -179,10 +179,10 @@ copy_file(FTSENT *entp, int dne)
 	rval = 0;
 
 	/* 
-	 * There's no reason to do anything other than close the file
-	 * now if it's regular and empty, so let's not bother.
+	 * We always copy regular files, even if they appear to be 0-sized
+	 * because kernfs and procfs don't return file sizes.
 	 */
-	bool need_copy = !S_ISREG(fs->st_mode) || fs->st_size > 0;
+	bool need_copy = S_ISREG(fs->st_mode) || fs->st_size > 0;
 
 	struct finfo fi;
 

Reply via email to