Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. switch (fork()) {
  2. case -1 :
  3. perror("Validator: fork");
  4. break;
  5. case 0 :
  6. //child code
  7. if (close(pipe_dsc[1]) == -1)
  8. perror("Error in close(pipe_dsc[1])");
  9. printf("KURWA CO SIE ODJEVBALO");
  10. fflush(stdin);
  11. execl("./run", "run", pipe_read_dsc_str, NULL);
  12. perror("Error in execl\n");
  13. break;
  14. default :
  15. // parent code
  16. if (close(pipe_dsc[0]) == -1)
  17. perror("Validator: Error in close(pipe_dsc[0])\n");
  18.  
  19. if (write(pipe_dsc[1], &am, sizeof(automaton)) != sizeof(automaton))
  20. perror("Validator: Error in write automaton\n");
  21.  
  22. if (write(pipe_dsc[1], &am, sizeof(automaton)) != sizeof(automaton))
  23. perror("Validator: Error in write automaton\n");
  24.  
  25. if (wait(0) == -1)
  26. perror("Validator: Error in wait\n");
  27. break;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement