From owner-freebsd-hackers Fri Jan 24 14:15: 9 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF8E537B401 for ; Fri, 24 Jan 2003 14:15:07 -0800 (PST) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2025343F5B for ; Fri, 24 Jan 2003 14:15:07 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org (UGLY.x.kientzle.comg [66.166.149.51] (may be forged)) by kientzle.com (8.11.3/8.11.3) with ESMTP id h0OMF6R07099 for ; Fri, 24 Jan 2003 14:15:06 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <3E31BAEA.7000500@acm.org> Date: Fri, 24 Jan 2003 14:15:06 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.ORG Subject: Ugly mount argv[0] trickery Content-Type: multipart/mixed; boundary="------------020100050001020302010807" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --------------020100050001020302010807 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit The attached patch eliminates a bit of unnecessary cleverness from 'mount.' If someone would do me the favor of committing this, I would greatly appreciate it. Namely, some mount_XXX helpers support multiple filesystem types and therefore must consider argv[0]. For no apparent reason, mount puts the filesystem type (e.g., 'nfs') into argv[0] rather than the executable name (e.g., 'mount_nfs'). This is unnecessary, counter-intuitive, and also makes it rather ugly to put 'mount' into a crunchgen binary. ;-) Tim Kientzle --------------020100050001020302010807 Content-Type: text/plain; name="kientzle_mount.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kientzle_mount.diff" Index: mount.c =================================================================== RCS file: /mnt/cvs/src/sbin/mount/mount.c,v retrieving revision 1.50 diff -c -r1.50 mount.c *** mount.c 14 Oct 2002 19:40:00 -0000 1.50 --- mount.c 24 Jan 2003 21:47:00 -0000 *************** *** 400,405 **** --- 400,406 ---- pid_t pid; int argc, i, status; char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN]; + char progname[MAXPATHLEN+1]; #if __GNUC__ (void)&optbuf; *************** *** 441,448 **** if (strcmp(vfstype, "msdos") == 0) vfstype = "msdosfs"; argc = 0; ! argv[argc++] = vfstype; mangle(optbuf, &argc, argv); argv[argc++] = spec; argv[argc++] = name; --- 442,451 ---- if (strcmp(vfstype, "msdos") == 0) vfstype = "msdosfs"; + snprintf(progname,sizeof(progname),"mount_%s",vfstype); + argc = 0; ! argv[argc++] = progname; mangle(optbuf, &argc, argv); argv[argc++] = spec; argv[argc++] = name; --------------020100050001020302010807-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message