]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Avoid multiple definitions of identical scandir cancellation handler
authorUlrich Drepper <drepper@gmail.com>
Mon, 8 Aug 2011 17:49:37 +0000 (13:49 -0400)
committerUlrich Drepper <drepper@gmail.com>
Mon, 8 Aug 2011 17:49:37 +0000 (13:49 -0400)
ChangeLog
dirent/scandir.c
dirent/scandir64.c
sysdeps/unix/sysv/linux/i386/scandir64.c

index f8212a61c05f241e5d8aee93ec625570157ecb4c..4b6a62f07aa0f88af528f634e5b825c8a034f24d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-08-08  Ulrich Drepper  <drepper@gmail.com>
+
+       * dirent/scandir.c (cancel_handler): Renamed to
+       __scandir_cancel_handler.  Do not define if SKIP_SCANDIR_CANCEL is
+       defined.  Adjust users.
+       * dirent/scandir64.c: Define SKIP_SCANDIR_CANCEL.
+       * sysdeps/unix/sysv/linux/i386/scandir64.c: Likewise.
+
 2011-08-04  Ulrich Drepper  <drepper@gmail.com>
 
        * string/test-string.h (IMPL): Use __STRING to expand name and then
index 2e03578a3cca7eb14cc74e0e1b6ee0bf0b1e48d8..e90b942b1d69030ae61a32d5b1f8d15d63536952 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992-1998,2000,2002,2003,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1998,2000,2002,2003,2009,2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <bits/libc-lock.h>
 
 #ifndef SCANDIR
-#define SCANDIR scandir
-#define READDIR __readdir
-#define DIRENT_TYPE struct dirent
+# define SCANDIR scandir
+# define READDIR __readdir
+# define DIRENT_TYPE struct dirent
 #endif
 
 #ifndef SCANDIR_CANCEL
-#define SCANDIR_CANCEL
+# define SCANDIR_CANCEL
 struct scandir_cancel_struct
 {
   DIR *dp;
@@ -37,8 +38,9 @@ struct scandir_cancel_struct
   size_t cnt;
 };
 
-static void
-cancel_handler (void *arg)
+# ifndef SKIP_SCANDIR_CANCEL
+void
+__scandir_cancel_handler (void *arg)
 {
   struct scandir_cancel_struct *cp = arg;
   size_t i;
@@ -49,6 +51,9 @@ cancel_handler (void *arg)
   free (v);
   (void) __closedir (cp->dp);
 }
+# else
+extern void __scandir_cancel_handler (void *arg);
+# endif
 #endif
 
 
@@ -75,7 +80,7 @@ SCANDIR (dir, namelist, select, cmp)
   c.dp = dp;
   c.v = NULL;
   c.cnt = 0;
-  __libc_cleanup_push (cancel_handler, &c);
+  __libc_cleanup_push (__scandir_cancel_handler, &c);
 
   while ((d = READDIR (dp)) != NULL)
     {
index b7bd654658200bd552e07302339600b18ed709ea..274822e125b7634a7b60190a1c45113ebc40b3ac 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
 #define SCANDIR scandir64
 #define READDIR __readdir64
 #define DIRENT_TYPE struct dirent64
+#define SKIP_SCANDIR_CANCEL 1
 
 int scandir64 (__const char *__restrict __dir,
               struct dirent64 ***__restrict __namelist,
index 690be813b711618074cfb85d774e67dc51b224f2..837e1b9438d323546db893e6ed78f936a130da6b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2004, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
 #define SCANDIR __scandir64
 #define READDIR __readdir64
 #define DIRENT_TYPE struct dirent64
+#define SKIP_SCANDIR_CANCEL 1
 
 #include <dirent/scandir.c>