From: Jakub Jelinek Date: Fri, 12 Jan 2007 17:20:09 +0000 (+0000) Subject: * misc/mntent_r.c (__hasmntopt): Check p[optlen] even when p == rest. X-Git-Tag: cvs/fedora-glibc-2_5-20070712T1701~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4570029c28345fa7e35f5b0250a6747b9a41019e;p=thirdparty%2Fglibc.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 51ad7245eb4..33811737341 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-12-09 Jakub Jelinek + + * 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 [BZ #3632] diff --git a/misc/Makefile b/misc/Makefile index f9ad0b76fc4..9eac1b62753 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -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 diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 1476c86ee2d..829750b395b 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -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;