From owner-p4-projects@FreeBSD.ORG Sat Sep 17 23:10:10 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6C1A416A421; Sat, 17 Sep 2005 23:10:10 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4461916A41F for ; Sat, 17 Sep 2005 23:10:10 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D4A543D48 for ; Sat, 17 Sep 2005 23:10:10 +0000 (GMT) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j8HNA9ad069850 for ; Sat, 17 Sep 2005 23:10:09 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j8HNA99q069847 for perforce@freebsd.org; Sat, 17 Sep 2005 23:10:09 GMT (envelope-from csjp@freebsd.org) Date: Sat, 17 Sep 2005 23:10:09 GMT Message-Id: <200509172310.j8HNA99q069847@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 83799 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2005 23:10:11 -0000 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); }