fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int token = 0;
  8.  
  9. typedef void (*function_ptr)();
  10.  
  11. void be_nice_to_people(){
  12. gid_t gid = getegid();
  13. setresgid(gid, gid, gid);
  14. }
  15.  
  16. int main(int argc, char **argv){
  17. char buf[128];
  18.  
  19. be_nice_to_people();
  20.  
  21. read(0, buf, 128);
  22.  
  23. ((function_ptr)buf)();
  24. }
  25.  
  26. return 0;
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
test
compilation info
In file included from /usr/include/endian.h:60:0,
                 from /usr/include/i386-linux-gnu/bits/waitstatus.h:64,
                 from /usr/include/stdlib.h:42,
                 from prog.c:5:
/usr/include/i386-linux-gnu/bits/byteswap.h: In function ‘main’:
/usr/include/i386-linux-gnu/bits/byteswap.h:45:1: error: invalid storage class for function ‘__bswap_32’
 __bswap_32 (unsigned int __bsx)
 ^
/usr/include/i386-linux-gnu/bits/byteswap.h:109:1: error: invalid storage class for function ‘__bswap_64’
 __bswap_64 (__uint64_t __bsx)
 ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/stdlib.h:278:1: error: nested function ‘atoi’ declared ‘extern’
 __NTH (atoi (const char *__nptr))
 ^
/usr/include/stdlib.h:278:1: error: static declaration of ‘atoi’ follows non-static declaration
In file included from prog.c:5:0:
/usr/include/stdlib.h:147:12: note: previous declaration of ‘atoi’ was here
 extern int atoi (const char *__nptr)
            ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/stdlib.h:283:1: error: nested function ‘atol’ declared ‘extern’
 __NTH (atol (const char *__nptr))
 ^
/usr/include/stdlib.h:283:1: error: static declaration of ‘atol’ follows non-static declaration
In file included from prog.c:5:0:
/usr/include/stdlib.h:150:17: note: previous declaration of ‘atol’ was here
 extern long int atol (const char *__nptr)
                 ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/stdlib.h:292:1: error: nested function ‘atoll’ declared ‘extern’
 __NTH (atoll (const char *__nptr))
 ^
/usr/include/stdlib.h:292:1: error: static declaration of ‘atoll’ follows non-static declaration
In file included from prog.c:5:0:
/usr/include/stdlib.h:157:36: note: previous declaration of ‘atoll’ was here
 __extension__ extern long long int atoll (const char *__nptr)
                                    ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/i386-linux-gnu/sys/sysmacros.h:44:1: error: nested function ‘gnu_dev_major’ declared ‘extern’
 __NTH (gnu_dev_major (unsigned long long int __dev))
 ^
/usr/include/i386-linux-gnu/sys/sysmacros.h:44:1: error: static declaration of ‘gnu_dev_major’ follows non-static declaration
In file included from /usr/include/i386-linux-gnu/sys/types.h:222:0,
                 from /usr/include/stdlib.h:314,
                 from prog.c:5:
/usr/include/i386-linux-gnu/sys/sysmacros.h:32:21: note: previous declaration of ‘gnu_dev_major’ was here
 extern unsigned int gnu_dev_major (unsigned long long int __dev)
                     ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/i386-linux-gnu/sys/sysmacros.h:50:1: error: nested function ‘gnu_dev_minor’ declared ‘extern’
 __NTH (gnu_dev_minor (unsigned long long int __dev))
 ^
/usr/include/i386-linux-gnu/sys/sysmacros.h:50:1: error: static declaration of ‘gnu_dev_minor’ follows non-static declaration
In file included from /usr/include/i386-linux-gnu/sys/types.h:222:0,
                 from /usr/include/stdlib.h:314,
                 from prog.c:5:
/usr/include/i386-linux-gnu/sys/sysmacros.h:35:21: note: previous declaration of ‘gnu_dev_minor’ was here
 extern unsigned int gnu_dev_minor (unsigned long long int __dev)
                     ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/i386-linux-gnu/sys/sysmacros.h:56:1: error: nested function ‘gnu_dev_makedev’ declared ‘extern’
 __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
 ^
/usr/include/i386-linux-gnu/sys/sysmacros.h:56:1: error: static declaration of ‘gnu_dev_makedev’ follows non-static declaration
In file included from /usr/include/i386-linux-gnu/sys/types.h:222:0,
                 from /usr/include/stdlib.h:314,
                 from prog.c:5:
/usr/include/i386-linux-gnu/sys/sysmacros.h:38:31: note: previous declaration of ‘gnu_dev_makedev’ was here
 extern unsigned long long int gnu_dev_makedev (unsigned int __major,
                               ^
In file included from /usr/include/features.h:371:0,
                 from /usr/include/stdio.h:27,
                 from prog.c:1:
/usr/include/i386-linux-gnu/bits/stdlib-float.h:26:1: error: nested function ‘atof’ declared ‘extern’
 __NTH (atof (const char *__nptr))
 ^
/usr/include/i386-linux-gnu/bits/stdlib-float.h:26:1: error: static declaration of ‘atof’ follows non-static declaration
In file included from prog.c:5:0:
/usr/include/stdlib.h:144:15: note: previous declaration of ‘atof’ was here
 extern double atof (const char *__nptr)
               ^
prog.c: In function ‘be_nice_to_people’:
prog.c:12:5: warning: implicit declaration of function ‘getegid’ [-Wimplicit-function-declaration]
     gid_t gid = getegid();
     ^
prog.c:13:5: warning: implicit declaration of function ‘setresgid’ [-Wimplicit-function-declaration]
     setresgid(gid, gid, gid);
     ^
prog.c: In function ‘main’:
prog.c:16:5: warning: ‘main’ is normally a non-static function [-Wmain]
 int main(int argc, char **argv){
     ^
prog.c: In function ‘main’:
prog.c:21:5: warning: implicit declaration of function ‘read’ [-Wimplicit-function-declaration]
     read(0, buf, 128);
     ^
prog.c: In function ‘main’:
prog.c:7:5: warning: unused variable ‘token’ [-Wunused-variable]
 int token = 0;
     ^
stdout
Standard output is empty