cybersecurity · intermediate · ~15 min

Does it refuse to follow symlinks?

Recognise the symlink-refusal flag.

Challenge

Implement int uses_nofollow(const char *flags) returning 1 if the open-flags string contains "O_NOFOLLOW", else 0.

Starter code

#include <string.h>

int uses_nofollow(const char *flags) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.