Serenity Operating System
at hosted 20 lines 386 B view raw
1#include <stdio.h> 2#include <unistd.h> 3#include <fcntl.h> 4 5int main() 6{ 7 int fd = open("hax", O_CREAT | O_RDWR, 0755); 8 ftruncate(fd, 0); 9 close(fd); 10 11 int rc = execlp("hax", "hax", nullptr); 12 int saved_errno = errno; 13 unlink("hax"); 14 if (rc == -1 && saved_errno == ENOEXEC) { 15 printf("FAIL\n"); 16 return 1; 17 } 18 printf("PASS\n"); 19 return 0; 20}