* 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.
This commit is contained in:
Jakub Jelinek 2007-01-12 17:20:09 +00:00
parent b6c657f557
commit 4570029c28
3 changed files with 13 additions and 8 deletions

View File

@ -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]

View 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

View 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;