PERFORCE change 147097 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Aug 10 18:11:00 UTC 2008


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

Change 147097 by trasz at trasz_traszkan on 2008/08/10 18:10:13

	Replace some asserts with proper error handling.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#10 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#10 (text+ko) ====

@@ -51,7 +51,8 @@
 	id_t *id;
 
 	error = acl_get_tag_type(entry, &tag);
-	assert(!error);
+	if (error)
+		return (error);
 
 	switch (tag) {
 	case ACL_USER_OBJ:
@@ -60,7 +61,8 @@
 
 	case ACL_USER:
 		id = (id_t *)acl_get_qualifier(entry);
-		assert(id);
+		if (id == NULL)
+			return (-1);
 		/* XXX: Thread-unsafe. */
 		if (!numeric)
 			pwd = getpwuid(*id);
@@ -78,7 +80,8 @@
 
 	case ACL_GROUP:
 		id = (id_t *)acl_get_qualifier(entry);
-		assert(id);
+		if (id == NULL)
+			return (-1);
 		/* XXX: Thread-unsafe. */
 		if (!numeric)
 			grp = getgrgid(*id);
@@ -95,7 +98,6 @@
 		break;
 
 	default:
-		assert(!"Tag?");
 		return (-1);
 	}
 
@@ -109,7 +111,8 @@
 	acl_extended_t extended;
 
 	error = acl_get_extended_np(entry, &extended);
-	assert(!error);
+	if (error)
+		return (error);
 
 	switch (extended) {
 	case ACL_EXTENDED_ALLOW:
@@ -129,7 +132,6 @@
 		break;
 
 	default:
-		assert(!"Extended?");
 		return (-1);
 	}
 
@@ -144,7 +146,8 @@
 	id_t *id;
 
 	error = acl_get_tag_type(entry, &tag);
-	assert(!error);
+	if (error)
+		return (error);
 
 	switch (tag) {
 	case ACL_USER_OBJ:
@@ -155,7 +158,8 @@
 
 	default:
 		id = (id_t *)acl_get_qualifier(entry);
-		assert(id);
+		if (id == NULL)
+			return (-1);
 		snprintf(str, size, ":%d", (unsigned int)*id);
 	}
 


More information about the p4-projects mailing list