cybersecurity · intermediate · ~15 min
`stat` and POSIX permission bits.
Implement int is_world_writable(const char *path) returning 1 if the file at path has the world-writable bit set (S_IWOTH), 0 if not, and -1 if stat fails.
#include <sys/stat.h>
int is_world_writable(const char *path) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.