Date: Tue, 5 Mar 1996 19:26:53 -0800 From: asami@cs.berkeley.edu (Satoshi Asami) 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 Subject: Re: cvs commit: src/sbin/mount mount.c Message-ID: <199603060326.TAA11194@sunrise.cs.berkeley.edu> In-Reply-To: <27226.825881116@time.cdrom.com> (jkh@time.cdrom.com)
next in thread | previous in thread | raw e-mail | index | archive | help
* > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603060326.TAA11194>