From owner-p4-projects Thu Aug 8 5:37: 6 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DAD5D37B401; Thu, 8 Aug 2002 05:37:00 -0700 (PDT) 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 8A02637B400 for ; Thu, 8 Aug 2002 05:37:00 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4652E43E42 for ; Thu, 8 Aug 2002 05:37:00 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g78Cb0JU019101 for ; Thu, 8 Aug 2002 05:37:00 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g78Cb0wZ019095 for perforce@freebsd.org; Thu, 8 Aug 2002 05:37:00 -0700 (PDT) Date: Thu, 8 Aug 2002 05:37:00 -0700 (PDT) Message-Id: <200208081237.g78Cb0wZ019095@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 15677 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15677 Change 15677 by rwatson@rwatson_tislabs on 2002/08/08 05:36:35 If no command line is passed to setpmac, default to executing the user's shell in an identical style to chroot(8). Affected files ... .. //depot/projects/trustedbsd/mac/usr.sbin/setpmac/setpmac.c#4 edit Differences ... ==== //depot/projects/trustedbsd/mac/usr.sbin/setpmac/setpmac.c#4 (text+ko) ==== @@ -1,7 +1,10 @@ #include #include +#include +#include #include +#include #include extern char **environ; @@ -9,10 +12,11 @@ int main(int argc, char *argv[]) { + const char *shell; struct mac *label; int error; - if (argc < 3) { + if (argc < 2) { fprintf(stderr, "setpmac [label] [binary] [args...]\n"); return (-1); } @@ -31,11 +35,14 @@ mac_free(label); - error = execve(argv[2], argv + 2, environ); - if (error) { - perror(argv[2]); - return (-1); + if (argc >= 3) { + execvp(argv[2], argv + 2); + err(1, "%s", argv[2]); + } else { + if (!(shell = getenv("SHELL"))) + shell = _PATH_BSHELL; + execlp(shell, shell, "-i", (char *)NULL); + err(1, "%s", shell); } - - return (0); + /* NOTREACHED */ } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message