PERFORCE change 77601 for review

Wayne Salamon wsalamon at FreeBSD.org
Fri May 27 18:06:20 PDT 2005


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

Change 77601 by wsalamon at rickenbacker on 2005/05/28 01:05:36

	Remove the setting of errno that was inherited from the OpenBSM code.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_token.c#7 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_bsm_token.c#7 (text+ko) ====

@@ -89,10 +89,8 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if(text == NULL) {
-		errno = EINVAL;
+	if(text == NULL)
 		return NULL;
-	}
 
 	textlen = strlen(text);
 	GET_TOKEN_AREA(t, dptr, 9 + textlen);
@@ -118,10 +116,8 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if(text == NULL) {
-		errno = EINVAL;
+	if(text == NULL)
 		return NULL;
-	}
 
 	textlen = strlen(text);
 	GET_TOKEN_AREA(t, dptr, 13 + textlen);
@@ -163,12 +159,9 @@
 	u_int16_t pad0_16 = 0;
 	u_int16_t pad0_32 = 0;
 
-	if(vni == NULL) {
-		errno = EINVAL;
+	if(vni == NULL)
 		return NULL;
-	}
 
-
 	GET_TOKEN_AREA(t, dptr, 29);
 	if(t == NULL) {
 		return NULL;
@@ -209,7 +202,7 @@
 
 token_t *au_to_attr64(struct vnode_au_info *vni)
 {
-	errno = ENOTSUP;
+
 	return NULL;
 }
 
@@ -234,10 +227,8 @@
 	u_char *dptr = NULL;
 	size_t datasize, totdata;
 
-	if(p == NULL) {
-		errno = EINVAL;
+	if(p == NULL)
 		return NULL;
-	}
 
 	/* Determine the size of the basic unit */
 	switch(unit_type) {
@@ -251,7 +242,6 @@
 						break;
 
 		default:
-			errno = EINVAL;
  			return NULL;
 	}
 
@@ -312,10 +302,8 @@
 	u_char *dptr = NULL;
 	int i;
 
-	if(groups == NULL) {
-		errno = EINVAL;
+	if(groups == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, n * 4 + 3);
 	if(t == NULL) {
@@ -343,10 +331,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(internet_addr == NULL) {
-		errno = EINVAL;
+	if(internet_addr == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 5);
 	if(t == NULL) {
@@ -370,10 +356,8 @@
 	u_char *dptr = NULL;
 	u_int32_t type = AF_INET6;
 
-	if(internet_addr == NULL) {
-		errno = EINVAL;
+	if(internet_addr == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 21);
 	if(t == NULL) {
@@ -399,10 +383,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(ip == NULL) {
-		errno = EINVAL;
+	if(ip == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 21);
 	if(t == NULL) {
@@ -458,10 +440,8 @@
 	u_int16_t pad0 = 0;
 
 
-	if(perm == NULL) {
-		errno = EINVAL;
+	if(perm == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 29);
 	if(t == NULL) {
@@ -531,10 +511,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if((data == NULL) || (bytes <= 0)) {
-		errno = EINVAL;
+	if((data == NULL) || (bytes <= 0))
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, bytes + 3);
 	if(t == NULL) {
@@ -574,10 +552,9 @@
 	}
 #endif
 
-	if(file == NULL) {
-		errno = EINVAL;
+	if(file == NULL)
 		return NULL;
-	}
+
 	filelen = strlen(file);
 	GET_TOKEN_AREA(t, dptr, filelen + 12);
 	if(t == NULL) {
@@ -609,10 +586,9 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if(text == NULL) {
-		errno = EINVAL;
+	if(text == NULL)
 		return NULL;
-	}
+
 	textlen = strlen(text);
 	GET_TOKEN_AREA(t, dptr, textlen + 4);
 	if(t == NULL) {
@@ -639,10 +615,9 @@
 	u_char *dptr = NULL;
 	u_int16_t textlen;
 
-	if(text == NULL) {
-		errno = EINVAL;
+	if(text == NULL)
 		return NULL;
-	}
+
 	textlen = strlen(text);
 	GET_TOKEN_AREA(t, dptr, textlen + 4);
 	if(t == NULL) {
@@ -678,10 +653,9 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(tid == NULL) {
-		errno = EINVAL;
+	if(tid == NULL)
 		return NULL;
-	}
+
 
 	GET_TOKEN_AREA(t, dptr, 37);
 	if(t == NULL) {
@@ -739,10 +713,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(tid == NULL) {
-		errno = EINVAL;
+	if(tid == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 53);
 	if(t == NULL) {
@@ -947,9 +919,6 @@
 	return t;
 }
 
-	return t;
-}
-
 /*
  * token ID                1 byte
  * socket family           2 bytes
@@ -961,10 +930,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(so == NULL) {
-		errno = EINVAL;
+	if(so == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 9);
 	if(t == NULL) {
@@ -990,10 +957,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(so == NULL) {
-		errno = EINVAL;
+	if(so == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 21);
 	if(t == NULL) {
@@ -1043,10 +1008,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(tid == NULL) {
-		errno = EINVAL;
+	if(tid == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 37);
 	if(t == NULL) {
@@ -1104,10 +1067,8 @@
 	token_t *t;
 	u_char *dptr = NULL;
 
-	if(tid == NULL) {
-		errno = EINVAL;
+	if(tid == NULL)
 		return NULL;
-	}
 
 	GET_TOKEN_AREA(t, dptr, 53);
 	if(t == NULL) {
@@ -1182,10 +1143,8 @@
 	int i, count = 0;
 	size_t totlen = 0;
 
-	if(args == NULL) {
-		errno = EINVAL;
+	if(args == NULL)
 		return NULL;
-	}
 
 	nextarg = *args;
 
@@ -1229,10 +1188,8 @@
 	size_t totlen = 0;
 	const char *nextenv;
 
-	if(env == NULL) {
-		errno = EINVAL;
+	if(env == NULL)
 		return NULL;
-	}
 
 	nextenv = *env;
 


More information about the p4-projects mailing list