mattrix

Untitled

May 28th, 2018
209
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <linux/reboot.h>
  2. #include <sys/syscall.h>
  3. #include <signal.h>
  4. #include <stdlib.h>
  5.  
  6. int main(int argc, char *argv[])  {
  7.     char *param = NULL;
  8.     int cmd;
  9.    
  10.     if(argc == 2) {
  11.         param = argv[1];
  12.         cmd = LINUX_REBOOT_CMD_RESTART2;
  13.     }
  14.     else {
  15.         cmd = LINUX_REBOOT_CMD_RESTART;
  16.     }
  17.  
  18.     sync();
  19.     system("/etc/init.d/rcK || /etc/init.d/rc 0");
  20.  
  21.     sync();
  22.     syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, param);
  23.    
  24.     return 0;
  25. }
RAW Paste Data