networking · beginner · ~15 min

Does the path fit in sun_path?

Respect the unix-socket path length limit.

Challenge

sockaddr_un.sun_path is 108 bytes including the NUL. Implement int path_fits_sun(const char *path) returning 1 if strlen(path) < 108, else 0.

Starter code

#include <string.h>

int path_fits_sun(const char *path) {
    /* TODO */
    return 0;
}

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