From owner-cvs-sbin Tue Mar 5 19:26:11 1996 Return-Path: owner-cvs-sbin Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id TAA23741 for cvs-sbin-outgoing; Tue, 5 Mar 1996 19:26:11 -0800 (PST) Received: from sunrise.cs.berkeley.edu (sunrise.CS.Berkeley.EDU [128.32.38.121]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id TAA23594 Tue, 5 Mar 1996 19:24:55 -0800 (PST) Received: (from asami@localhost) by sunrise.cs.berkeley.edu (8.6.12/8.6.12) id TAA11194; Tue, 5 Mar 1996 19:26:53 -0800 Date: Tue, 5 Mar 1996 19:26:53 -0800 Message-Id: <199603060326.TAA11194@sunrise.cs.berkeley.edu> To: jkh@time.cdrom.com CC: rgrimes@gndrsh.aac.dev.com, jkh@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-sbin@freefall.freebsd.org In-reply-to: <27226.825881116@time.cdrom.com> (jkh@time.cdrom.com) Subject: Re: cvs commit: src/sbin/mount mount.c From: asami@cs.berkeley.edu (Satoshi Asami) Sender: owner-cvs-sbin@FreeBSD.ORG Precedence: bulk * > mount: exec mount_foo could not be found in /sbin, /usr/sbin: No such file or * directory * * Look at the code - this kind of error message is not easy to emit * without fundamentally changing more structure than I felt was wise. * The search list is an arbitrary path, you see. I know it's no big deal but this message has bugged me in the past too. What about this? === Index: mount.c =================================================================== RCS file: /usr/cvs/src/sbin/mount/mount.c,v retrieving revision 1.9 diff -u -r1.9 mount.c --- 1.9 1996/03/03 08:44:22 +++ mount.c 1996/03/06 03:20:54 @@ -332,8 +332,20 @@ (void)snprintf(execname, sizeof(execname), "%s/mount_%s", *edir, vfstype); execv(execname, (char * const *)argv); - warn("exec %s for %s", execname, name); } while (*++edir != NULL); + if (errno == ENOENT) { + char tmp[sizeof(edirs)+5]; + tmp[0] = '\0'; + edir = edirs; + do { + strcat(tmp, *edir); + strcat(tmp, ", "); + } while (*++edir != NULL); + /* now delete the last ", " */ + tmp[strlen(tmp)-2] = '\0'; + warn("exec mount_%s could not be found in %s", + vfstype, tmp); + } exit(1); /* NOTREACHED */ default: /* Parent. */ === Actually, if I know how to call warn() (or an equivalent) without letting it emit the "No such file or directory" message first, we don't have to build the string and it will be even simpler.... Satoshi