about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-09-06 23:57:15 -0400
committerRich Felker <dalias@aerifal.cx>2012-09-06 23:57:15 -0400
commit780aede41913528781bbc8ff0d0e27505595f7c0 (patch)
treec2de26e7307bd266f6f8e535907aff491dd448fc /src
parentc4ea0e3f8e286ec535691560d234d923b7f5d821 (diff)
downloadmusl-780aede41913528781bbc8ff0d0e27505595f7c0.tar.gz
musl-780aede41913528781bbc8ff0d0e27505595f7c0.tar.xz
musl-780aede41913528781bbc8ff0d0e27505595f7c0.zip
fix constraint violation in ftw
void* does not implicitly convert to function pointer types.
Diffstat (limited to 'src')
-rw-r--r--src/misc/ftw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/misc/ftw.c b/src/misc/ftw.c
index de01e39c..0429aba4 100644
--- a/src/misc/ftw.c
+++ b/src/misc/ftw.c
@@ -3,7 +3,10 @@
 
 int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int fd_limit)
 {
-	return nftw(path, (void *)fn, fd_limit, FTW_PHYS);
+	/* The following cast assumes that calling a function with one
+	 * argument more than it needs behaves as expected. This is
+	 * actually undefined, but works on all real-world machines. */
+	return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS);
 }
 
 LFS64(ftw);