bitwiseworks / libc

LIBC Next (kLIBC fork)
9 stars 3 forks source link

spawn*(P_WAIT) returns 0 for an abort()ed child process #136

Open komh opened 11 months ago

komh commented 11 months ago

Hi/2.

According to document, abort()ed process should return with code 3.

In practice, VAC++ 3.08 and EMX returns with code 3. OW returns with code 255.

However, kLIBC and LIBCn returns with code 0. This is problematic.

Here is a test program.

/* abort.c */
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <sys/wait.h>

int child( int argc, char *argv[])
{
    abort();

    exit( 3 );

    return 0;
}

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

    if( argc > 1 )
        return child( argc, argv );

    rc = spawnl( P_WAIT, argv[ 0 ], argv[ 0 ], argv[ 0 ], NULL );

    printf("spawnl() = %d\n", rc );

    return 0;
}
dmik commented 11 months ago

Could you please check if it happens with LIBCn 0.1.12 as well with some older LIBCn (0.1.10 for instance) or even with Knut's LIBC?

komh commented 11 months ago

Both kLIBC v0.6.6 and LIBCn v0.1.12 have the same problem.