Description of problem: The ftw() syscall needs a pointer to a callback function that returns an int, according to the manpage for ftw(3). But a program that uses ftw() produces an warning for an incompatible pointer type for this argument (test case attached). I am not sure if this is a user error, a syscall issue or a manpage erratum. Version-Release number of selected component (if applicable): gcc -v produces Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux Thread model: posix gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) How reproducible: Always Steps to Reproduce: 1. Compile the attached testcase ftw.c using GCC, and see the warning ftw.c: In function âmainâ: ftw.c:38: warning: passing argument 2 of âftwâ from incompatible pointer type 2. The program appears to run correctly (it lists filetypes for all files under "/home"). But the warning persists. Actual results: Warning as shown above. Expected results: No warnings. Additional info: Casts to (int *) and to __ftw_func_t did not clear the warning.
Created attachment 118234 [details] Testcase: compile with 'gcc ftw.c'
1) ftw is not a syscall 2) this is a user error Look at ftw prototype from man page: int ftw(const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag), int nopenfd); or info libc --index-search="ftw" where __ftw_func_t has int (*) (const char *, const struct stat *, int) type. But you are passing a funciton with incompatible type - int (*) (char *, struct stat *, int). Add the const keywords and the warnings will go away.