From owner-p4-projects@FreeBSD.ORG Fri Nov 14 19:06:54 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F2DDD16A4D0; Fri, 14 Nov 2003 19:06:53 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CEF2A16A4CE for ; Fri, 14 Nov 2003 19:06:53 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3CAFB43FB1 for ; Fri, 14 Nov 2003 19:06:53 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAF36rXJ003215 for ; Fri, 14 Nov 2003 19:06:53 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAF36qCI003212 for perforce@freebsd.org; Fri, 14 Nov 2003 19:06:52 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Fri, 14 Nov 2003 19:06:52 -0800 (PST) Message-Id: <200311150306.hAF36qCI003212@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 42422 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2003 03:06:54 -0000 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")); }