StudyingUnixInterface/4/fileDirectory/umask.c

18 lines
374 B
C
Raw Normal View History

2020-12-07 04:17:01 +00:00
#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");
}
}