PERFORCE change 71656 for review

Robert Watson rwatson at FreeBSD.org
Wed Feb 23 11:58:49 GMT 2005


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

Change 71656 by rwatson at rwatson_paprika on 2005/02/23 11:58:23

	If oldp is set, sysctl returns the value of a MIB entry before
	modification, rather than after.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#85 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#85 (text+ko) ====

@@ -152,6 +152,27 @@
         if (index > MAC_BSDEXTENDED_MAXRULES)
 		return (ENOENT);
 
+	if (req->oldptr) {
+		mtx_lock(&mac_bsdextended_mtx);
+		if (index < 0 || index > rule_slots + 1) {
+			mtx_unlock(&mac_bsdextended_mtx);
+			return (ENOENT);
+		}
+
+		if (rules[index] == NULL) {
+			mtx_unlock(&mac_bsdextended_mtx);
+			return (ENOENT);
+		}
+
+		temprule = *rules[index];
+		mtx_unlock(&mac_bsdextended_mtx);
+
+		error = SYSCTL_OUT(req, &temprule, sizeof(temprule));
+
+		if (error)
+			return (error);
+	}
+
 	if (req->newptr) {
 		if (req->newlen == 0) {
 			/* printf("deletion\n"); */
@@ -194,27 +215,6 @@
 		}
 	}
 
-	if (req->oldptr) {
-		mtx_lock(&mac_bsdextended_mtx);
-		if (index < 0 || index > rule_slots + 1) {
-			mtx_unlock(&mac_bsdextended_mtx);
-			return (ENOENT);
-		}
-
-		if (rules[index] == NULL) {
-			mtx_unlock(&mac_bsdextended_mtx);
-			return (ENOENT);
-		}
-
-		temprule = *rules[index];
-		mtx_unlock(&mac_bsdextended_mtx);
-
-		error = SYSCTL_OUT(req, &temprule, sizeof(temprule));
-
-		if (error)
-			return (error);
-	}
-
 	return (0);
 }
 


More information about the p4-projects mailing list