[Openswan dev] [PATCH] fix scandir incompatible pointer type warning

Gilles Espinasse g.esp at free.fr
Sat Jun 20 10:23:56 EDT 2009


google say cast is the way to go for scandir
http://gcc.gnu.org/ml/java-patches/2003-q1/msg00113.html

Fix
/usr/src/openswan-2.6.22rc2/lib/libopenswan/x509chain.c:211: warning: passing argument 3 of 'scandir' from incompatible pointer type
/usr/src/openswan-2.6.22rc2/programs/pluto/ac.c:740: warning: passing argument 3 of 'scandir' from incompatible pointer type
/usr/src/openswan-2.6.22rc2/programs/pluto/x509.c:434: warning: passing argument 3 of 'scandir' from incompatible pointer type

Signed-off-by: Gilles Espinasse <g.esp at free.fr>
---
 lib/libopenswan/x509chain.c |    2 +-
 programs/pluto/ac.c         |    2 +-
 programs/pluto/x509.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libopenswan/x509chain.c b/lib/libopenswan/x509chain.c
index 3107e99..a7f4d13 100644
--- a/lib/libopenswan/x509chain.c
+++ b/lib/libopenswan/x509chain.c
@@ -208,7 +208,7 @@ load_authcerts(const char *type, const char *path, u_char auth_flags)
     else
     {
 	openswan_log("Changed path to directory '%s'", path);
-	n = scandir(".", &filelist, file_select, alphasort);
+	n = scandir(".", &filelist, (void *) file_select, alphasort);
 
 	if (n < 0){
 	    char buff[256];
diff --git a/programs/pluto/ac.c b/programs/pluto/ac.c
index b745bab..7b16a56 100644
--- a/programs/pluto/ac.c
+++ b/programs/pluto/ac.c
@@ -737,7 +737,7 @@ load_acerts(void)
 	int n;
 
 	openswan_log("Changing to directory '%s'", oco->acerts_dir);
-	n = scandir(oco->acerts_dir, &filelist, file_select, alphasort);
+	n = scandir(oco->acerts_dir, &filelist, (void *) file_select, alphasort);
 
 	if (n > 0)
 	{
diff --git a/programs/pluto/x509.c b/programs/pluto/x509.c
index bd06ec3..bf8cc6d 100644
--- a/programs/pluto/x509.c
+++ b/programs/pluto/x509.c
@@ -431,7 +431,7 @@ load_crls(void)
     else
     {
 	openswan_log("Changing to directory '%s'", oco->crls_dir);
-	n = scandir(oco->crls_dir, &filelist, file_select, alphasort);
+	n = scandir(oco->crls_dir, &filelist, (void *) file_select, alphasort);
 
 	if (n <= 0)
 	    openswan_log("  Warning: empty directory");
-- 
1.6.0.6



More information about the Dev mailing list