printf("preopens = %s\n", preopens);
if( preopens )
{
+ int exp_fd = 0;
while( *preopens )
{
const char *splitter = strchr(preopens, ':');
int fd = acess__SysOpen(path, 6); // WRITE,READ,no EXEC
if( fd == -1 ) {
fprintf(stderr, "Unable to preopen '%s' errno=%i\n", path, acess__errno);
+ exit(1);
}
+ if( fd != exp_fd ) {
+ // Oh... this is bad
+ fprintf(stderr, "Pre-opening '%s' resulted in an incorrect FD (expected %i, got %i)",
+ path, exp_fd, fd);
+ exit(1);
+ }
+ exp_fd += 1;
if( !splitter )
break;
printf("\n");
}
-void __libc_csu_fini()
-{
-}
-
-void __libc_csu_init()
-{
-}
-
-void __stack_chk_fail(void)
-{
- fprintf(stderr, "__stack_chk_fail");
- exit(1);
-}
-