Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Sep 2005 23:10:09 GMT
From:      "Christian S.J. Peron" <csjp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 83799 for review
Message-ID:  <200509172310.j8HNA99q069847@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=83799

Change 83799 by csjp@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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509172310.j8HNA99q069847>