Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2005 11:58:47 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 71656 for review
Message-ID:  <200502231158.j1NBwljD042625@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=71656

Change 71656 by rwatson@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);
 }
 



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