]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* sysdeps/unix/sysv/linux/rtld-lowlevel.h
authorUlrich Drepper <drepper@redhat.com>
Sat, 9 Dec 2006 22:29:37 +0000 (22:29 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 9 Dec 2006 22:29:37 +0000 (22:29 +0000)
(__rtld_mrlock_initialize): Add missing closing parenthesis.

misc/Makefile
misc/getusershell.c
misc/mntent_r.c
misc/tst-mntent2.c [new file with mode: 0644]
nptl/ChangeLog
nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h

index f9ad0b76fc466bc421019aa0ab079f4c3e20ac6f..9eac1b62753d1f5d8465e9faee9491ede765f526 100644 (file)
@@ -78,7 +78,7 @@ endif
 gpl2lgpl := error.c error.h
 
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
-        tst-error1 tst-pselect tst-insremque
+        tst-error1 tst-pselect tst-insremque tst-mntent2
 ifeq (no,$(cross-compiling))
 tests: $(objpfx)tst-error1-mem
 endif
index 255b579b1ad83987477a919e79fe6a90c09e621d..636da322f961fd127910845adb47842f9bf0a3ec 100644 (file)
@@ -98,7 +98,7 @@ initshells()
        register char **sp, *cp;
        register FILE *fp;
        struct stat64 statb;
-       int flen;
+       size_t flen;
 
        free(shells);
        shells = NULL;
@@ -114,9 +114,11 @@ initshells()
                okshells[1] = _PATH_CSHELL;
                return (char **) okshells;
        }
-       if ((strings = malloc((u_int)statb.st_size + 1)) == NULL)
+       if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
                goto init_okshells;
-       shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
+       if ((strings = malloc(statb.st_size + 2)) == NULL)
+               goto init_okshells;
+       shells = malloc(statb.st_size / 3 * sizeof (char *));
        if (shells == NULL) {
                free(strings);
                strings = NULL;
@@ -124,11 +126,11 @@ initshells()
        }
        sp = shells;
        cp = strings;
-       flen = statb.st_size;
+       flen = statb.st_size + 2;
        while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
                while (*cp != '#' && *cp != '/' && *cp != '\0')
                        cp++;
-               if (*cp == '#' || *cp == '\0')
+               if (*cp == '#' || *cp == '\0' || cp[1] == '\0')
                        continue;
                *sp++ = cp;
                while (!isspace(*cp) && *cp != '#' && *cp != '\0')
index 1476c86ee2da183006b2a947b8c319afee2fb89a..829750b395b51b8c9ec0558fc0208f14fe5898d5 100644 (file)
@@ -1,5 +1,6 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006
+   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
@@ -278,14 +279,11 @@ __hasmntopt (const struct mntent *mnt, const char *opt)
 
   while ((p = strstr (rest, opt)) != NULL)
     {
-      if (p == rest
-         || (p[-1] == ','
-             && (p[optlen] == '\0' ||
-                 p[optlen] == '='  ||
-                 p[optlen] == ',')))
+      if ((p == rest || p[-1] == ',')
+         && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ','))
        return p;
 
-      rest = strchr (rest, ',');
+      rest = strchr (p, ',');
       if (rest == NULL)
        break;
       ++rest;
diff --git a/misc/tst-mntent2.c b/misc/tst-mntent2.c
new file mode 100644 (file)
index 0000000..6c25e01
--- /dev/null
@@ -0,0 +1,41 @@
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+
+int
+main (void)
+{
+  int result = 0;
+  struct mntent mef;
+
+  mef.mnt_fsname = strdupa ("/dev/sdf6");
+  mef.mnt_dir = strdupa ("/some dir");
+  mef.mnt_type = strdupa ("ext3");
+  mef.mnt_opts = strdupa ("opt1,opt2,noopt=6,rw,norw,brw");
+  mef.mnt_freq = 1;
+  mef.mnt_passno = 2;
+
+#define TEST(opt, found) \
+  if (!!hasmntopt (&mef, (opt)) != (found))                            \
+    {                                                                  \
+      printf ("Option %s was %sfound\n", (opt), (found) ? "not " : "");        \
+      result = 1;                                                      \
+    }
+
+  TEST ("opt1", 1)
+  TEST ("opt2", 1)
+  TEST ("noopt", 1)
+  TEST ("rw", 1)
+  TEST ("norw", 1)
+  TEST ("brw", 1)
+  TEST ("opt", 0)
+  TEST ("oopt", 0)
+  TEST ("w", 0)
+  TEST ("r", 0)
+  TEST ("br", 0)
+  TEST ("nor", 0)
+  TEST ("or", 0)
+
+  return result;
+}
index c65b60dbffa04628dd940891a799dce6cd0287fd..20f530077afb172c6ff245f15362d14877e15d5d 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-09  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/unix/sysv/linux/rtld-lowlevel.h
+       (__rtld_mrlock_initialize): Add missing closing parenthesis.
+
 2006-10-30  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/ia64/pthread_spin_unlock.c (pthread_spin_unlock): Use
index bc7a6454eaf3819fe42ada27f0930f1261d4659c..6b3d3682da1fd69379b55164ebb64cfdb6c2b5b7 100644 (file)
@@ -43,7 +43,7 @@ typedef int __rtld_mrlock_t;
 
 #define _RTLD_MRLOCK_INITIALIZER 0
 #define __rtld_mrlock_initialize(NAME) \
-  (void) ((NAME) = 0
+  (void) ((NAME) = 0)
 
 
 #define __rtld_mrlock_lock(lock) \