diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-02-26 21:15:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-02-26 21:15:32 +0000 |
commit | 95562a554805b23e90de4f29735e72c7c84868b5 (patch) | |
tree | a7b7844ee678ba53ee5787a861ee69bf7393375d /lib/libc | |
parent | c8f5b1c2bb8664783a626647f61dd17868900e3c (diff) |
Fix negation of POSIX character classes; passed new regress test.
OK tb@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/fnmatch.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index 0d0f18ff434..c1753582fab 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/fnmatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fnmatch.c,v 1.19 2015/08/01 18:11:08 millert Exp $ */ +/* $OpenBSD: fnmatch.c,v 1.20 2016/02/26 21:15:31 millert Exp $ */ /* Copyright (c) 2011, VMware, Inc. * All rights reserved. @@ -27,7 +27,7 @@ */ /* - * Copyright (c) 2008 Todd C. Miller <millert@openbsd.org> + * Copyright (c) 2008, 2016 Todd C. Miller <millert@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -187,10 +187,16 @@ static int fnmatch_ch(const char **pattern, const char **string, int flags) break; /* Match character classes. */ - if (classmatch(*pattern, **string, nocase, pattern) - == RANGE_MATCH) { + switch (classmatch(*pattern, **string, nocase, pattern)) { + case RANGE_MATCH: result = 0; continue; + case RANGE_NOMATCH: + /* Valid character class but no match. */ + continue; + default: + /* Not a valid character class. */ + break; } if (!**pattern) break; |