1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/* * Rule: FIO01-C * Source: wiki * Status: PASS - Should NOT trigger FIO01-C violation */ char *file_name; int fd; /* Initialize file_name */ fd = open( file_name, O_WRONLY | O_CREAT | O_EXCL, S_IRWXU ); if (fd == -1) { /* Handle error */ } /* ... */ if (fchmod(fd, S_IRUSR) == -1) { /* Handle error */ }