]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2.3.3-74 cvs/fedora-glibc-2_3_3-74
authorJakub Jelinek <jakub@redhat.com>
Wed, 27 Oct 2004 21:39:59 +0000 (21:39 +0000)
committerJakub Jelinek <jakub@redhat.com>
Wed, 27 Oct 2004 21:39:59 +0000 (21:39 +0000)
15 files changed:
ChangeLog
elf/Makefile
elf/dl-fini.c
elf/dl-open.c
elf/tst-dlmopen1mod.c
elf/tst-dlmopen3.c [new file with mode: 0644]
fedora/glibc.spec.in
include/resolv.h
posix/Makefile
posix/bug-glob2.c [new file with mode: 0644]
resolv/res_data.c
resolv/res_debug.c
resolv/res_mkquery.c
sysdeps/generic/glob.c
sysdeps/gnu/netinet/udp.h

index 4fe8706511faf7d1c296e9ef44844b2e7902711b..084dc6c8b48d1656dafdde69c7649330248e3926 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@
 
 2004-10-27  Ulrich Drepper  <drepper@redhat.com>
 
+       * elf/dl-open.c (_dl_open): Don't allow explicitly opening a DSO
+       into an empty namespace.
+
        * elf/dl-fini.c (_dl_fini): Fix search for map in maps array.
        Reverse order of namespaces.
        * elf/Makefile: Add rules to build and run tst-dlmopen3.
index 0bec4abbb767d4a4b3900efa07a380582884890b..028be25b2da990f1856fea7e52768cf85957c396 100644 (file)
@@ -154,7 +154,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
         circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
         tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
         $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
-        tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2
+        tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3
 #       reldep9
 test-srcs = tst-pathopt
 tests-vis-yes = vismain
@@ -770,3 +770,6 @@ $(objpfx)tst-dlmopen1.out: $(objpfx)tst-dlmopen1mod.so
 
 $(objpfx)tst-dlmopen2: $(libdl)
 $(objpfx)tst-dlmopen2.out: $(objpfx)tst-dlmopen1mod.so
+
+$(objpfx)tst-dlmopen3: $(libdl)
+$(objpfx)tst-dlmopen3.out: $(objpfx)tst-dlmopen1mod.so
index 33036b5cbdebd8f7b659c4484d0f69aeca1a560a..f43f4a00ed2fc89f860fbccff8d51ac58e8d1a3c 100644 (file)
@@ -42,23 +42,18 @@ _dl_fini (void)
      using `dlopen' there are possibly several other modules with its
      dependencies to be taken into account.  Therefore we have to start
      determining the order of the modules once again from the beginning.  */
-  unsigned int i;
-  unsigned int nloaded;
-  struct link_map *l;
   struct link_map **maps = NULL;
   size_t maps_size = 0;
 
-  /* We First run the destructors of the main namespaces, then the
-     other ones.  The order should not matter since the namespace
-     content is supposed to be independent.  But we can have auditing
-     code in a auxiliaty namespace and we want it to monitor the
-     destructors.  */
-  for (Lmid_t cnt = 0; cnt < DL_NNS; ++cnt)
+  /* We run the destructors of the main namespaces last.  As for the
+     other namespaces, we pick run the destructors in them in reverse
+     order of the namespace ID.  */
+  for (Lmid_t cnt = DL_NNS - 1; cnt >= 0; --cnt)
     {
       /* Protect against concurrent loads and unloads.  */
       __rtld_lock_lock_recursive (GL(dl_load_lock));
 
-      nloaded = GL(dl_ns)[cnt]._ns_nloaded;
+      unsigned int nloaded = GL(dl_ns)[cnt]._ns_nloaded;
 
       /* XXX Could it be (in static binaries) that there is no object
         loaded?  */
@@ -79,20 +74,20 @@ _dl_fini (void)
                             nloaded * sizeof (struct link_map *));
        }
 
+      unsigned int i;
+      struct link_map *l;
       for (l = GL(dl_ns)[cnt]._ns_loaded, i = 0; l != NULL; l = l->l_next)
-       {
-         assert (i < nloaded);
+       /* Do not handle ld.so in secondary namespaces.  */
+       if (l == l->l_real)
+         {
+           assert (i < nloaded);
 
-         /* Do not handle ld.so in secondary namespaces.  */
-         if (l == l->l_real)
-           {
-             maps[i++] = l;
+           maps[i++] = l;
 
-             /* Bump l_opencount of all objects so that they are not
-                dlclose()ed from underneath us.  */
-             ++l->l_opencount;
-           }
-       }
+           /* Bump l_opencount of all objects so that they are not
+              dlclose()ed from underneath us.  */
+           ++l->l_opencount;
+         }
       assert (cnt != LM_ID_BASE || i == nloaded);
       assert (cnt == LM_ID_BASE || i == nloaded || i == nloaded - 1);
       unsigned int nmaps = i;
@@ -105,46 +100,23 @@ _dl_fini (void)
            /* The main executable always comes first.  */
            l = l->l_next;
          for (; l != NULL; l = l->l_next)
-           {
-             unsigned int j;
-             unsigned int k;
-
-             /* Find the place in the 'maps' array.  */
-             for (j = 1; maps[j] != l; ++j)
-               ;
-
-             /* Find all object for which the current one is a dependency and
-                move the found object (if necessary) in front.  */
-             for (k = j + 1; k < nmaps; ++k)
-               {
-                 struct link_map **runp = maps[k]->l_initfini;
-                 if (runp != NULL)
-                   {
-                     while (*runp != NULL)
-                       if (*runp == l)
-                         {
-                           struct link_map *here = maps[k];
-
-                           /* Move it now.  */
-                           memmove (&maps[j] + 1,
-                                    &maps[j],
-                                    (k - j) * sizeof (struct link_map *));
-                           maps[j++] = here;
-
-                           break;
-                         }
-                       else
-                         ++runp;
-                   }
-
-                 if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
-                   {
-                     unsigned int m = maps[k]->l_reldepsact;
-                     struct link_map **relmaps = maps[k]->l_reldeps;
-
-                     while (m-- > 0)
-                       {
-                         if (relmaps[m] == l)
+           /* Do not handle ld.so in secondary namespaces.  */
+           if (l == l->l_real)
+             {
+               /* Find the place in the 'maps' array.  */
+               unsigned int j;
+               for (j = cnt == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
+                 assert (j < nmaps);
+
+               /* Find all object for which the current one is a dependency
+                  and move the found object (if necessary) in front.  */
+               for (unsigned int k = j + 1; k < nmaps; ++k)
+                 {
+                   struct link_map **runp = maps[k]->l_initfini;
+                   if (runp != NULL)
+                     {
+                       while (*runp != NULL)
+                         if (*runp == l)
                            {
                              struct link_map *here = maps[k];
 
@@ -152,14 +124,37 @@ _dl_fini (void)
                              memmove (&maps[j] + 1,
                                       &maps[j],
                                       (k - j) * sizeof (struct link_map *));
-                             maps[j] = here;
+                             maps[j++] = here;
 
                              break;
                            }
-                       }
-                   }
-               }
-           }
+                         else
+                           ++runp;
+                     }
+
+                   if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
+                     {
+                       unsigned int m = maps[k]->l_reldepsact;
+                       struct link_map **relmaps = maps[k]->l_reldeps;
+
+                       while (m-- > 0)
+                         {
+                           if (relmaps[m] == l)
+                             {
+                               struct link_map *here = maps[k];
+
+                               /* Move it now.  */
+                               memmove (&maps[j] + 1,
+                                        &maps[j],
+                                        (k - j) * sizeof (struct link_map *));
+                               maps[j] = here;
+
+                               break;
+                             }
+                         }
+                     }
+                 }
+             }
        }
 
       /* We do not rely on the linked list of loaded object anymore from
index 2ab1e307a4e36b131119fea541396d9984c73b80..294a523aac192d85ac93035a471784f5b02721e1 100644 (file)
@@ -570,6 +570,12 @@ _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid)
 no more namespaces available for dlmopen()"));
        }
     }
+  /* Never allow loading a DSO in a namespace which is empty.  Such
+     direct placements is only causing problems.  */
+  else if (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER
+          && GL(dl_ns)[nsid]._ns_nloaded == 0)
+    GLRO(dl_signal_error) (EINVAL, file, NULL,
+                          N_("invalid target namespace in dlmopen()"));
 
   args.file = file;
   args.mode = mode;
index 40a4c8fa4419b7d0bf4232be7881ffe8945242e3..142488098a061ef50ad9a5fdf297175ef79b49d8 100644 (file)
@@ -3,6 +3,16 @@
 #include <gnu/lib-names.h>
 
 
+static int cnt;
+
+static void
+__attribute ((constructor))
+constr (void)
+{
+  ++cnt;
+}
+
+
 int
 foo (Lmid_t ns2)
 {
@@ -34,5 +44,16 @@ foo (Lmid_t ns2)
       return 1;
     }
 
+  if (cnt == 0)
+    {
+      puts ("constructor did not run");
+      return 1;
+    }
+  else if (cnt != 1)
+    {
+      puts ("constructor did not run exactly once");
+      return 1;
+    }
+
   return 0;
 }
diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
new file mode 100644 (file)
index 0000000..da951ca
--- /dev/null
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <gnu/lib-names.h>
+
+
+static int
+do_test (void)
+{
+  void *h = dlmopen (LM_ID_NEWLM, "$ORIGIN/tst-dlmopen1mod.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      printf ("cannot get handle for %s: %s\n",
+             "tst-dlmopen1mod.so", dlerror ());
+      return 1;
+    }
+
+  /* Do not unload.  */
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index 6e9da80df284aa57d7c781d33f60efaa7e94e940..02644ed9170fd5442c07dcb3a174c58b74e0edc5 100644 (file)
@@ -1,4 +1,4 @@
-%define glibcrelease 73
+%define glibcrelease 74
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@@ -1256,6 +1256,14 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Wed Oct 27 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-74
+- fix <netinet/udp.h> header
+- fix globfree (#137176)
+- fix exiting if there are dlmopened libraries in namespaces
+  other than main one not closed yet
+- export again _res_opcodes and __p_{class,type}_syms from
+  libresolv.so that were lost in -69
+
 * Thu Oct 21 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-73
 - remove setaltroot and key{_add,_request,ctl} also from Versions
 - back out _sys_errlist changes
index 6f1c343b4a83166500a56754df7d2712fa1ad112..9c24bd3bc764c80a34b99a503a1948356f090aca 100644 (file)
@@ -98,6 +98,9 @@ libresolv_hidden_proto (__ns_name_unpack)
 libresolv_hidden_proto (__ns_get16)
 libresolv_hidden_proto (__ns_get32)
 
+extern const char *_res_opcodes[];
+libresolv_hidden_proto (_res_opcodes)
+
 #endif
 
 #endif
index 9bf415fdbf35189710072cac3c0a372b4007f81c..cd6a52c0989ca5ed4e5a87d60fb4a9e26da7f592 100644 (file)
@@ -82,7 +82,7 @@ tests         := tstgetopt testfnm runtests runptests      \
                   bug-regex21 bug-regex22 bug-regex23 tst-nice tst-nanosleep \
                   transbug tst-rxspencer tst-pcre tst-boost \
                   bug-ga1 tst-vfork1 tst-vfork2 tst-waitid \
-                  tst-getaddrinfo2 bug-glob1
+                  tst-getaddrinfo2 bug-glob1 bug-glob2
 xtests         := bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs      := globtest
@@ -101,7 +101,7 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
             bug-regex21-mem bug-regex21.mtrace \
             tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
             tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
-            bug-ga2.mtrace bug-ga2-mem
+            bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem
 
 include ../Rules
 
@@ -194,7 +194,8 @@ tests: $(objpfx)annexc.out
 ifeq (no,$(cross-compiling))
 tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
   $(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \
-  $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out
+  $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
+  $(objpfx)bug-glob2-mem
 xtests: $(objpfx)bug-ga2-mem
 endif
 
@@ -251,3 +252,8 @@ $(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
        $(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@
 
 bug-ga2-ENV = MALLOC_TRACE=$(objpfx)bug-ga2.mtrace
+
+bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace
+
+$(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
+       $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@
diff --git a/posix/bug-glob2.c b/posix/bug-glob2.c
new file mode 100644 (file)
index 0000000..88e3558
--- /dev/null
@@ -0,0 +1,303 @@
+/* Test glob memory management.
+   for the filesystem access functions.
+   Copyright (C) 2001, 2002, 2004 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <dirent.h>
+#include <glob.h>
+#include <mcheck.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+
+// #define DEBUG
+#ifdef DEBUG
+# define PRINTF(fmt, args...) \
+  do                                   \
+    {                                  \
+      int save_errno = errno;          \
+      printf (fmt, ##args);            \
+      errno = save_errno;              \
+    } while (0)
+#else
+# define PRINTF(fmt, args...)
+#endif
+
+
+static struct
+{
+  const char *name;
+  int level;
+  int type;
+  mode_t mode;
+} filesystem[] =
+{
+  { ".", 1, DT_DIR, 0755 },
+  { "..", 1, DT_DIR, 0755 },
+  { "dir", 1, DT_DIR, 0755 },
+    { ".", 2, DT_DIR, 0755 },
+    { "..", 2, DT_DIR, 0755 },
+    { "readable", 2, DT_DIR, 0755 },
+      { ".", 3, DT_DIR, 0755 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 },
+    { "unreadable", 2, DT_DIR, 0111 },
+      { ".", 3, DT_DIR, 0111 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 },
+    { "zz-readable", 2, DT_DIR, 0755 },
+      { ".", 3, DT_DIR, 0755 },
+      { "..", 3, DT_DIR, 0755 },
+      { "a", 3, DT_REG, 0644 }
+};
+#define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
+
+
+typedef struct
+{
+  int level;
+  int idx;
+  struct dirent d;
+  char room_for_dirent[NAME_MAX];
+} my_DIR;
+
+
+static long int
+find_file (const char *s)
+{
+  int level = 1;
+  long int idx = 0;
+
+  if (strcmp (s, ".") == 0)
+    return 0;
+
+  if (s[0] == '.' && s[1] == '/')
+    s += 2;
+
+  while (*s != '\0')
+    {
+      char *endp = strchrnul (s, '/');
+
+      PRINTF ("looking for %.*s, level %d\n", (int) (endp - s), s, level);
+
+      while (idx < nfiles && filesystem[idx].level >= level)
+       {
+         if (filesystem[idx].level == level
+             && memcmp (s, filesystem[idx].name, endp - s) == 0
+             && filesystem[idx].name[endp - s] == '\0')
+           break;
+         ++idx;
+       }
+
+      if (idx == nfiles || filesystem[idx].level < level)
+       {
+         errno = ENOENT;
+         return -1;
+       }
+
+      if (*endp == '\0')
+       return idx + 1;
+
+      if (filesystem[idx].type != DT_DIR
+         && (idx + 1 >= nfiles
+             || filesystem[idx].level >= filesystem[idx + 1].level))
+       {
+         errno = ENOTDIR;
+         return -1;
+       }
+
+      ++idx;
+
+      s = endp + 1;
+      ++level;
+    }
+
+  errno = ENOENT;
+  return -1;
+}
+
+
+static void *
+my_opendir (const char *s)
+{
+  long int idx = find_file (s);
+  my_DIR *dir;
+
+  if (idx == -1)
+    {
+      PRINTF ("my_opendir(\"%s\") == NULL (%m)\n", s);
+      return NULL;
+    }
+
+  if ((filesystem[idx].mode & 0400) == 0)
+    {
+      errno = EACCES;
+      PRINTF ("my_opendir(\"%s\") == NULL (%m)\n", s);
+      return NULL;
+    }
+
+  dir = (my_DIR *) malloc (sizeof (my_DIR));
+  if (dir == NULL)
+    {
+      printf ("cannot allocate directory handle: %m\n");
+      exit (EXIT_FAILURE);
+    }
+
+  dir->level = filesystem[idx].level;
+  dir->idx = idx;
+
+  PRINTF ("my_opendir(\"%s\") == { level: %d, idx: %ld }\n",
+         s, filesystem[idx].level, idx);
+
+  return dir;
+}
+
+
+static struct dirent *
+my_readdir (void *gdir)
+{
+  my_DIR *dir = gdir;
+
+  if (dir->idx == -1)
+    {
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+             dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  while (dir->idx < nfiles && filesystem[dir->idx].level > dir->level)
+    ++dir->idx;
+
+  if (dir->idx == nfiles || filesystem[dir->idx].level < dir->level)
+    {
+      dir->idx = -1;
+      PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+             dir->level, (long int) dir->idx);
+      return NULL;
+    }
+
+  dir->d.d_ino = dir->idx;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  dir->d.d_type = filesystem[dir->idx].type;
+#endif
+
+  strcpy (dir->d.d_name, filesystem[dir->idx].name);
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_type: %d, d_name: \"%s\" }\n",
+         dir->level, (long int) dir->idx, dir->d.d_ino, dir->d.d_type,
+         dir->d.d_name);
+#else
+  PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_name: \"%s\" }\n",
+         dir->level, (long int) dir->idx, dir->d.d_ino,
+         dir->d.d_name);
+#endif
+
+  ++dir->idx;
+
+  return &dir->d;
+}
+
+
+static void
+my_closedir (void *dir)
+{
+  PRINTF ("my_closedir ()\n");
+  free (dir);
+}
+
+
+/* We use this function for lstat as well since we don't have any.  */
+static int
+my_stat (const char *name, struct stat *st)
+{
+  long int idx = find_file (name);
+
+  if (idx == -1)
+    {
+      PRINTF ("my_stat (\"%s\", ...) = -1 (%m)\n", name);
+      return -1;
+    }
+
+  memset (st, '\0', sizeof (*st));
+
+  if (filesystem[idx].type == DT_UNKNOWN)
+    st->st_mode = DTTOIF (idx + 1 < nfiles
+                         && filesystem[idx].level < filesystem[idx + 1].level
+                         ? DT_DIR : DT_REG) | filesystem[idx].mode;
+  else
+    st->st_mode = DTTOIF (filesystem[idx].type) | filesystem[idx].mode;
+
+  PRINTF ("my_stat (\"%s\", { st_mode: %o }) = 0\n", name, st->st_mode);
+
+  return 0;
+}
+
+
+static void
+init_glob_altdirfuncs (glob_t *pglob)
+{
+  pglob->gl_closedir = my_closedir;
+  pglob->gl_readdir = my_readdir;
+  pglob->gl_opendir = my_opendir;
+  pglob->gl_lstat = my_stat;
+  pglob->gl_stat = my_stat;
+}
+
+
+int
+do_test (void)
+{
+  mtrace ();
+
+  glob_t gl;
+  memset (&gl, 0, sizeof (gl));
+  init_glob_altdirfuncs (&gl);
+
+  if (glob ("dir/*able/*", GLOB_ERR | GLOB_ALTDIRFUNC, NULL, &gl)
+      != GLOB_ABORTED)
+    {
+      puts ("glob did not fail with GLOB_ABORTED");
+      exit (EXIT_FAILURE); 
+    }
+
+  globfree (&gl);
+
+  memset (&gl, 0, sizeof (gl));
+  init_glob_altdirfuncs (&gl);
+
+  gl.gl_offs = 3;
+  if (glob ("dir2/*", GLOB_DOOFFS, NULL, &gl) != GLOB_NOMATCH)
+    {
+      puts ("glob did not fail with GLOB_NOMATCH");
+      exit (EXIT_FAILURE); 
+    }
+
+  globfree (&gl);
+
+  muntrace ();
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index 438f815605d95a282dbd5fbff60e2a047867310e..adadcdcd7ac80250000cfe13e5fd1d45d154220e 100644 (file)
@@ -39,7 +39,7 @@ static const char rcsid[] = "$BINDId: res_data.c,v 8.17 1999/10/13 17:11:31 vixi
 #include <string.h>
 #include <unistd.h>
 
-const char *_res_opcodes[] attribute_hidden = {
+const char *_res_opcodes[] = {
        "QUERY",
        "IQUERY",
        "CQUERYM",
@@ -57,6 +57,7 @@ const char *_res_opcodes[] attribute_hidden = {
        "ZONEINIT",
        "ZONEREF",
 };
+libresolv_hidden_data_def (_res_opcodes)
 
 #ifdef BIND_UPDATE
 const char *_res_sectioncodes[] attribute_hidden = {
index 6b719d1f2d8108d2efc2248ea6780d3a3b4ef61d..839069de3da49c6930a10286f43194d7088bba4f 100644 (file)
@@ -118,7 +118,6 @@ static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vix
 # define SPRINTF(x) sprintf x
 #endif
 
-extern const char *_res_opcodes[] attribute_hidden;
 extern const char *_res_sectioncodes[] attribute_hidden;
 
 /*
@@ -349,7 +348,9 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
  * that C_ANY is a qclass but not a class.  (You can ask for records of class
  * C_ANY, but you can't have any records of that class in the database.)
  */
-const struct res_sym __p_class_syms[] attribute_hidden = {
+extern const struct res_sym __p_class_syms[];
+libresolv_hidden_proto (__p_class_syms)
+const struct res_sym __p_class_syms[] = {
        {C_IN,          "IN"},
        {C_CHAOS,       "CHAOS"},
        {C_HS,          "HS"},
@@ -358,6 +359,7 @@ const struct res_sym __p_class_syms[] attribute_hidden = {
        {C_NONE,        "NONE"},
        {C_IN,          (char *)0}
 };
+libresolv_hidden_data_def (__p_class_syms)
 
 /*
  * Names of message sections.
@@ -401,7 +403,9 @@ const struct res_sym __p_cert_syms[] attribute_hidden = {
  * that T_ANY is a qtype but not a type.  (You can ask for records of type
  * T_ANY, but you can't have any records of that type in the database.)
  */
-const struct res_sym __p_type_syms[] attribute_hidden = {
+extern const struct res_sym __p_type_syms[];
+libresolv_hidden_proto (__p_type_syms)
+const struct res_sym __p_type_syms[] = {
        {ns_t_a,        "A",            "address"},
        {ns_t_ns,       "NS",           "name server"},
        {ns_t_md,       "MD",           "mail destination (deprecated)"},
@@ -448,6 +452,7 @@ const struct res_sym __p_type_syms[] attribute_hidden = {
        {ns_t_any,      "ANY",          "\"any\""},
        {0,             NULL,           NULL}
 };
+libresolv_hidden_data_def (__p_type_syms)
 
 /*
  * Names of DNS rcodes.
index 875d495b72f8e18f9a50250f7163a944d37dd385..815fcf8ab371cbe02cdcbee307721662c52ec4a5 100644 (file)
@@ -88,8 +88,6 @@ static const char rcsid[] = "$BINDId: res_mkquery.c,v 8.12 1999/10/13 16:39:40 v
 # endif
 #endif
 
-extern const char *_res_opcodes[];
-
 /*
  * Form all types of queries.
  * Returns the size of the result or -1.
index 658599ec1f2783d517402d11dec280e3812bda19..c0e76b377e5a0e2b8edf30f6982a7d414ef3b64d 100644 (file)
@@ -1135,6 +1135,7 @@ globfree (pglob)
        if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
          free ((__ptr_t) pglob->gl_pathv[pglob->gl_offs + i]);
       free ((__ptr_t) pglob->gl_pathv);
+      pglob->gl_pathv = NULL;
     }
 }
 #if defined _LIBC && !defined globfree
index 8977712822b3f5e8a322bd2145506707d6c56dd6..45b69f7499494a73603ecbae2840489653933b38 100644 (file)
 
 /* UDP header as specified by RFC 768, August 1980. */
 #ifdef __FAVOR_BSD
+
 struct udphdr
 {
-  uint16_t uh_sport;           /* source port */
-  uint16_t uh_dport;           /* destination port */
-  uint16_t uh_ulen;            /* udp length */
-  uint16_t uh_sum;             /* udp checksum */
+  u_int16_t uh_sport;          /* source port */
+  u_int16_t uh_dport;          /* destination port */
+  u_int16_t uh_ulen;           /* udp length */
+  u_int16_t uh_sum;            /* udp checksum */
 };
+
 #else
 
 struct udphdr
 {
-  uint16_t source;
-  uint16_t dest;
-  uint16_t len;
-  uint16_t check;
+  u_int16_t source;
+  u_int16_t dest;
+  u_int16_t len;
+  u_int16_t check;
 };
 #endif