Opened 10 years ago

#330 new defect

spawn() fails to execute a shell script if a dir whose name is same as an interpreter exists

Reported by: KO Myung-Hun Owned by:
Priority: normal Milestone: libc-0.7
Component: libc Version: 0.6.6
Severity: normal Keywords:
Cc:

Description

Hi/2.

For examples,

spawn.c

#include <stdio.h>
#include <process.h>

int main( int argc, char *argv[])
{
    int rc;

    if( argc < 2 )
    {
        fprintf( stderr, "Usage: spawn program\n");

        return 1;
    }

    rc = spawnvp( P_WAIT, argv[ 1 ], &argv[ 1 ]);
    printf("spawnvp() = %d\n", rc );
    if( rc == -1 )
        perror("spawnvp()");

    return !!rc;
}

spawn.pl

print "$0: hello\n";

When trying

mkdir perl
spawn spawn.pl

the result is

spawnvp() = -1
spawnvp(): Permission denied

Change History (0)

Note: See TracTickets for help on using tickets.