changeset 3424:f0ff4b8bcfe1

4485000 *sum* may return success after encountering errors
author mp204432
date Mon, 15 Jan 2007 23:24:33 -0800
parents fd25d153620d
children 69e10a2dd6f0
files usr/src/cmd/sum/sum.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/sum/sum.c	Mon Jan 15 19:07:15 2007 -0800
+++ b/usr/src/cmd/sum/sum.c	Mon Jan 15 23:24:33 2007 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
  */
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -34,6 +33,8 @@
  */
 
 
+#define	TRUE	1
+#define	FALSE	0
 #define	WDMSK 0177777L
 #define	BUFSIZE 512
 #include <locale.h>
@@ -55,7 +56,7 @@
 	int		ca;
 	int		i		= 0;
 	int		alg		= 0;
-	int		errflg		= 0;
+	char		errflg		= FALSE;
 	int		c;
 	FILE		*f;
 	long long	nbytes;
@@ -91,7 +92,7 @@
 			if ((f = fopen(argv[i], "r")) == NULL) {
 				(void) fprintf(stderr, "sum: %s ", argv[i]);
 				perror("");
-				errflg += 10;
+				errflg = TRUE;
 				continue;
 			}
 		} else
@@ -116,7 +117,7 @@
 			}
 		}
 		if (ferror(f)) {
-			errflg++;
+			errflg = TRUE;
 			(void) fprintf(stderr, gettext("sum: read error "
 			    "on '%s': %s\n"), (argc > 0) ? argv[i] : "-",
 			    strerror(errno));