like chmod, but avoid changing permission of /dev/null */
| 149 | |
| 150 | /* like chmod, but avoid changing permission of /dev/null */ |
| 151 | int UTIL_chmod(char const* filename, const stat_t* statbuf, mode_t permissions) |
| 152 | { |
| 153 | stat_t localStatBuf; |
| 154 | if (statbuf == NULL) { |
| 155 | if (!UTIL_stat(filename, &localStatBuf)) return 0; |
| 156 | statbuf = &localStatBuf; |
| 157 | } |
| 158 | if (!UTIL_isRegularFileStat(statbuf)) return 0; /* pretend success, but don't change anything */ |
| 159 | return chmod(filename, permissions); |
| 160 | } |
| 161 | |
| 162 | int UTIL_setFileStat(const char *filename, const stat_t *statbuf) |
| 163 | { |
no test coverage detected