Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2003 19:06:52 -0800 (PST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42422 for review
Message-ID:  <200311150306.hAF36qCI003212@repoman.freebsd.org>

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

Change 42422 by rwatson@rwatson_tislabs on 2003/11/14 19:06:46

	Let mac_prepare_type() initialize the internal database, rather
	than initializing in the older wrapper functions.  Otherwise,
	the database isn't initialized if applications only use
	mac_prepare_type().

Affected files ...

.. //depot/projects/trustedbsd/mac/lib/libc/posix1e/mac.c#12 edit

Differences ...

==== //depot/projects/trustedbsd/mac/lib/libc/posix1e/mac.c#12 (text+ko) ====

@@ -358,9 +358,15 @@
 mac_prepare_type(struct mac **mac, const char *name)
 {
 	struct label_default *ld;
+	int error;
 
+	error = mac_maybe_init_internal();
+	if (error != 0)
+		return (error);
+
 	for (ld = LIST_FIRST(&label_default_head); ld != NULL;
 	    ld = LIST_NEXT(ld, ld_entries)) {
+		printf("%s\n", ld->ld_name);
 		if (strcmp(name, ld->ld_name) == 0)
 			return (mac_prepare(mac, ld->ld_labels));
 	}
@@ -372,23 +378,13 @@
 int
 mac_prepare_ifnet_label(struct mac **mac)
 {
-	int error;
 
-	error = mac_maybe_init_internal();
-	if (error != 0)
-		return (error);
-
 	return (mac_prepare_type(mac, "ifnet"));
 }
 
 int
 mac_prepare_file_label(struct mac **mac)
 {
-	int error;
-
-	error = mac_maybe_init_internal();
-	if (error != 0)
-		return (error);
 
 	return (mac_prepare_type(mac, "file"));
 }
@@ -396,23 +392,13 @@
 int
 mac_prepare_packet_label(struct mac **mac)
 {
-	int error;
 
-	error = mac_maybe_init_internal();
-	if (error != 0)
-		return (error);
-
 	return (mac_prepare_type(mac, "packet"));
 }
 
 int
 mac_prepare_process_label(struct mac **mac)
 {
-	int error;
-
-	error = mac_maybe_init_internal();
-	if (error != 0)
-		return (error);
 
 	return (mac_prepare_type(mac, "process"));
 }



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