Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2011 17:17:31 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216922 - head/bin/setfacl
Message-ID:  <201101031717.p03HHVUC099586@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Mon Jan  3 17:17:31 2011
New Revision: 216922
URL: http://svn.freebsd.org/changeset/base/216922

Log:
  Increase carried_error if we skip a file due to an error. This ensures
  that setfacl(1) exits with proper exit status on failure.
  
  PR:		bin/149780
  Submitted by:	Ævar Arnfjörð Bjarmason (original version)
  Reviewed by:	trasz
  MFC after:	3 weeks

Modified:
  head/bin/setfacl/setfacl.c

Modified: head/bin/setfacl/setfacl.c
==============================================================================
--- head/bin/setfacl/setfacl.c	Mon Jan  3 16:29:00 2011	(r216921)
+++ head/bin/setfacl/setfacl.c	Mon Jan  3 17:17:31 2011	(r216922)
@@ -201,12 +201,14 @@ main(int argc, char *argv[])
 
 		if (stat(file->filename, &sb) == -1) {
 			warn("%s: stat() failed", file->filename);
+			carried_error++;
 			continue;
 		}
 
 		if (acl_type == ACL_TYPE_DEFAULT && S_ISDIR(sb.st_mode) == 0) {
 			warnx("%s: default ACL may only be set on a directory",
 			    file->filename);
+			carried_error++;
 			continue;
 		}
 
@@ -218,6 +220,7 @@ main(int argc, char *argv[])
 			if (acl_type == ACL_TYPE_DEFAULT) {
 				warnx("%s: there are no default entries "
 			           "in NFSv4 ACLs", file->filename);
+				carried_error++;
 				continue;
 			}
 			acl_type = ACL_TYPE_NFS4;
@@ -240,6 +243,7 @@ main(int argc, char *argv[])
 			else
 				warn("%s: acl_get_file() failed",
 				    file->filename);
+			carried_error++;
 			continue;
 		}
 



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