Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

library/3056: exec(3) doesn't document EISDIR, but implementation returns it

From: <adi(at)hexapodia.org>
Date: Mon Dec 30 2002 - 11:42:41 EST


>Number: 3056
>Category: library
>Synopsis: exec(3) doesn't document EISDIR, but implementation returns it
>Confidential: no
net
>Environment:

	System      : OpenBSD 2.9
	Architecture: OpenBSD.i386
	Machine     : i386

>Description:
exec(3) doesn't document an error of EISDIR, but libc's implementation returns EISDIR under the appropriate circumstances. It seems more sensible to make the code conform to the documentation than vice versa.

>How-To-Repeat:
% mkdir /tmp/foo
% mkdir /tmp/foo/ls
% cat foo.c
#include 
#include <string.h>

#include <errno.h>
#include <unistd.h>

int main(void)
{

    execlp("ls", "ls", "-l", (char*)0);
    fprintf(stderr, "ls: %s\n", strerror(errno));     return 1;
}
% cc foo.c
% env PATH=/tmp/foo:$PATH ./a.out
ls: Is a directory
%
>Fix:

(Untested, alas.)
Index: exec.c



RCS file: /cvsup/OpenBSD/src/lib/libc/gen/exec.c,v retrieving revision 1.12
diff -u -r1.12 exec.c
--- exec.c	2002/02/19 19:39:36	1.12
+++ exec.c	2002/12/30 16:34:13
@@ -211,6 +211,7 @@
 		switch(errno) {
 		case E2BIG:
 			goto done;
+		case EISDIR:
 		case ELOOP:
 		case ENAMETOOLONG:
 		case ENOENT:

>Release-Note:
>Audit-Trail:
>Unformatted:
Received on Mon Dec 30 16:55:48 2002

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:43 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library