Advertisement
rotrevrep

Untitled

Oct 23rd, 2013
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <errno.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6.  
  7. #define MY_MASK 0777
  8.  
  9. int main()
  10. {
  11.   int temp;
  12.  
  13.   printf("Default mask: %o\n", MY_MASK & ~022 & MY_MASK);
  14.  
  15.   temp = umask(0);
  16.   printf("Previous umask = %o\n", temp);
  17.   if ((temp = mkdir("foodir", MY_MASK)) != 0) {
  18.     fprintf(stderr, "ERROR %d: unable to mkdir; %s\n", errno, strerror(errno));
  19.   }
  20.  
  21.   return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement