nftw different on BSD?
问题 I'm trying to get all .c files in a directory tree using nftw with the following code: static int gf(const char *path, const struct stat *st, int t, struct FTW *ftw) { if (t != FTW_F) return 0; if (strcmp(ext(path), ".c") == 0) addl(&files, dup(abspath(path))); return 0; } void getfiles(char *path) { nftw(path, gf, 255, FTW_PHYS); } It works on Linux and Solaris, but on PC-BSD it fails by simply not picking up any files. What am I missing? 回答1: What is the return value of nftw ? If it's -1