PERFORCE change 83799 for review

Christian S.J. Peron csjp at FreeBSD.org
Sat Sep 17 23:10:09 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=83799

Change 83799 by csjp at csjp_xor on 2005/09/17 23:09:37

	Keep track of any error which occurs. Error should not be fatal if a
	single operation fails but we should keep track of the fact that an
	error occured on one of the files so we can propagate it back to the
	shell. This seems to be what most userspace utilities which handle
	file lists do.

Affected files ...

.. //depot/projects/trustedbsd/mac/usr.sbin/getfhash/getfhash.c#13 edit

Differences ...

==== //depot/projects/trustedbsd/mac/usr.sbin/getfhash/getfhash.c#13 (text+ko) ====

@@ -48,6 +48,8 @@
 static int	print_hash_from_stdin(void);
 
 static int	 depth;
+static int	 eval;
+
 static int	 dflag;
 static int	 rflag;
 static char	*mflag;
@@ -186,15 +188,19 @@
 			warn("extattr_delete_file failed");
 		return;
 	}
-	if (syscall(SYS_mac_syscall, "mac_chkexec", 0, pathname) < 0)
+	if (syscall(SYS_mac_syscall, "mac_chkexec", 0, pathname) < 0) {
+		eval++;
 		warn("%s", pathname);
+	}
 	if (!mflag)
 		return;
 	slen = strlen(mflag);
 	error = extattr_set_file(pathname, MAC_CHKEXEC_ATTRN,
 	    MAC_CHKEXEC_DEP, mflag, slen);
-	if (error < 0)
+	if (error < 0) {
+		eval++;
 		warn("extattr_set_file failed");
+	}
 }
 
 static void
@@ -299,5 +305,5 @@
 		} else 
 			handler(argv[i]);
 	}
-	return (0);
+	return (eval);
 }
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list