lkml.org 
[lkml]   [1998]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectexecve changes break execlp with 2.1.122

Linux dd 2.1.122 #2 SMP Sat Sep 19 20:30:23 PDT 1998 i686

strace'ing the following program demonstrates that execve
changed its return code when a non-existant directory
was in the path. One may argue that this is a library problem
but was it necessary to change the system call?

older versions including 2.1.121 set errno to ENOENT from execve
but 2.1.122 with pre-patch-2.1.123-1.gz applied sets errno to ENOTDIR.

This breaks make and other programs that use execlp or execvp
when there are non-existant directories earlier in the PATH.


The program assumes that /bin/echo exists.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
if (putenv("PATH=/non_existant_directory:/bin") == -1) {
perror("putenv");
return 2;
}
if (execlp("echo", "echo", "execlp of echo ok", 0) == -1) {
perror("bug in execlp or execve");
return 1;
}
return 0;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.284 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site