]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* misc/mntent_r.c (__hasmntopt): Check p[optlen] even when p == rest.
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Jan 2007 17:20:09 +0000 (17:20 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 12 Jan 2007 17:20:09 +0000 (17:20 +0000)
Start searching for next comma at p rather than rest.
* misc/Makefile (tests): Add tst-mntent2.
* misc/tst-mntent2.c: New test.

ChangeLog
misc/Makefile
misc/mntent_r.c

index 51ad7245eb42b908c460c6c4aa3853ada02d4d43..33811737341098423475bb5e6fa071fffdca96dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-09  Jakub Jelinek  <jakub@redhat.com>
+
+       * misc/mntent_r.c (__hasmntopt): Check p[optlen] even when p == rest.
+       Start searching for next comma at p rather than rest.
+       * misc/Makefile (tests): Add tst-mntent2.
+       * misc/tst-mntent2.c: New test.
+
 2006-12-09  Ulrich Drepper  <drepper@redhat.com>
 
        [BZ #3632]
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 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;