From owner-p4-projects@FreeBSD.ORG Thu Feb 23 19:19:15 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 09B7216A423; Thu, 23 Feb 2006 19:19:15 +0000 (GMT) X-Original-To: perforce@freebsd.org 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 C2D9116A420 for ; Thu, 23 Feb 2006 19:19:14 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F43C43D46 for ; Thu, 23 Feb 2006 19:19:14 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k1NJJEaK015026 for ; Thu, 23 Feb 2006 19:19:14 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k1NJJE7J015023 for perforce@freebsd.org; Thu, 23 Feb 2006 19:19:14 GMT (envelope-from millert@freebsd.org) Date: Thu, 23 Feb 2006 19:19:14 GMT Message-Id: <200602231919.k1NJJE7J015023@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 92284 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2006 19:19:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=92284 Change 92284 by millert@millert_g4tower on 2006/02/23 19:19:13 Convert some if() else to switch(). Affected files ... .. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/kern/security.c#4 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/kern/security.c#4 (text+ko) ==== @@ -87,12 +87,16 @@ rc = mac_check_service_access(&subjl, &objl, serv, perm); mac_destroy_task_label(&subjl); mac_destroy_task_label(&objl); - if (rc == /*EINVAL*/ 22) + + switch (rc) { + case 0: + return KERN_SUCCESS; + case 22: + /* EINVAL */ return KERN_INVALID_ARGUMENT; - else if (rc != 0) + default: return KERN_NO_ACCESS; - else - return 0; + } } kern_return_t @@ -143,12 +147,15 @@ io_unlock (objp); mac_destroy_task_label(&subjl); - if (rc == /*EINVAL*/ 22) + switch (rc) { + case 0: + return KERN_SUCCESS; + case 22: + /* EINVAL */ return KERN_INVALID_ARGUMENT; - else if (rc != 0) + default: return KERN_NO_ACCESS; - else - return 0; + } } kern_return_t @@ -197,12 +204,15 @@ io_unlock(objp); ipc_port_multiple_unlock(); - if (rc == /*EINVAL*/ 22) + switch (rc) { + case 0: + return KERN_SUCCESS; + case 22: + /* EINVAL */ return KERN_INVALID_ARGUMENT; - else if (rc != 0) + default: return KERN_NO_ACCESS; - else - return 0; + } errout: io_unlocklabel(subp);