StudyingUnixInterface/4/fileDirectory/umask.c
2020-12-07 12:17:01 +08:00

18 lines
374 B
C

#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#define RWRWRW S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
int main(void) {
umask(0);
if(creat("./test/test1", RWRWRW) < 0){
printf("creat error for test1\n");
}
umask(S_IWGRP | S_IROTH | S_IWOTH);
if(creat("./test/test2", RWRWRW) < 0){
printf("creat error for test1\n");
}
}