`if (sun->sun_path[0] != '\0') {` - slightly more efficient.

You should probably zero sun_path[0] before calling recvmsg() in case the kernel doesn't copy out the socket path.  Linux and the BSDs do but I'm not sure about Solaris.