From owner-freebsd-bugs Tue Dec 17 10:36:12 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id KAA11123 for bugs-outgoing; Tue, 17 Dec 1996 10:36:12 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id KAA11115; Tue, 17 Dec 1996 10:36:00 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id FAA00022; Wed, 18 Dec 1996 05:33:45 +1100 Date: Wed, 18 Dec 1996 05:33:45 +1100 From: Bruce Evans Message-Id: <199612171833.FAA00022@godzilla.zeta.org.au> To: freebsd-bugs@freefall.freebsd.org, wollman@freefall.freebsd.org, zgabor@code.hu Subject: Re: kern/1487 Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Synopsis: bug in exec(2) > >State-Changed-From-To: feedback-open >State-Changed-By: wollman >State-Changed-When: Tue Dec 17 08:16:21 PST 1996 >State-Changed-Why: >Not sure what the systus of this is, but there doesn't appear to >be any feedback. This seems to be a simple bug in execvp(). Please review this fix. It handles ENOTDIR essentially the same as /bin/sh. Oops. I already see some bugs: - if the ENOTDIR occurs for every try, then the final errno should be ENOTDIR, just like it would be for execv(). ENOTDIR errors should be handled something like EACCES errors. - the handling of EACCES errors is probably wrong. EACCES is returned if an EACCES occurs for _at least_ one try. This is probably best if there are only EACCES and ENOENT errors. However, if there are EACCES and ENOTDIR and possibly ENOENT errors, then the final errno should probably be ENOTDIR, just like it would be for attempts to execv() (or read) a file in an inaccessible non-directory (rm -rf /tmp/notdir; touch /tmp/notdir; chmod 0 /tmp/notdir; /tmp/notdir/nonesuch gives ENOTDIR). Bruce diff -c2 exec.c~ exec.c *** exec.c~ Wed Nov 20 02:07:18 1996 --- exec.c Wed Dec 18 04:54:36 1996 *************** *** 259,262 **** --- 259,264 ---- free(memp); goto done; + case ENOTDIR: + break; case ETXTBSY: if (etxtbsy < 3)