Advertisement
Guest User

Untitled

a guest
Aug 13th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (! S_ISREG (st . st_mode)) {
  2.         fprintf (stderr, "%s is not a normal file\n", argv[1]);
  3.         exit(EXIT_FAILURE);
  4. }
  5.  
  6. // this sleep creates a time gap to change the file and create a symbolic link
  7. sleep (10);
  8.  
  9. if ((fp = fopen (argv [1], "w")) == NULL) {
  10.         fprintf (stderr, "Can't open\n");
  11.         exit(EXIT_FAILURE);
  12. }
  13.  
  14. fprintf (fp, "%s\n", argv [2]);
  15. fclose (fp);
  16. fprintf (stderr, "Write Ok\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement