Module Name:    src
Committed By:   christos
Date:           Sun Jan 14 17:39:19 UTC 2024

Modified Files:
        src/usr.bin/wc: wc.c

Log Message:
Better check against st_size == 0 instead of st_dev == -1


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/wc/wc.c

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

Modified files:

Index: src/usr.bin/wc/wc.c
diff -u src/usr.bin/wc/wc.c:1.36 src/usr.bin/wc/wc.c:1.37
--- src/usr.bin/wc/wc.c:1.36	Sun Jan 14 12:16:10 2024
+++ src/usr.bin/wc/wc.c	Sun Jan 14 12:39:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: wc.c,v 1.36 2024/01/14 17:16:10 christos Exp $	*/
+/*	$NetBSD: wc.c,v 1.37 2024/01/14 17:39:19 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1987, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)wc.c	8.2 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: wc.c,v 1.36 2024/01/14 17:16:10 christos Exp $");
+__RCSID("$NetBSD: wc.c,v 1.37 2024/01/14 17:39:19 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -239,8 +239,7 @@ cnt(const char *file)
 				warn("%s", name);
 				rval = 1;
 			} else {
-				/* st_dev == -1 for kernfs/procfs files */
-				if (sb.st_dev != (dev_t)-1 &&
+				if (sb.st_size != 0 &&
 				    (S_ISREG(sb.st_mode) ||
 				    S_ISLNK(sb.st_mode) ||
 				    S_ISDIR(sb.st_mode))) {

Reply via email to