﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
193	fnmatch() implementation is broken	guest	bird	"According to http://www.opengroup.org/onlinepubs/000095399/functions/fnmatch.html[[BR]]

''If string matches the pattern specified by pattern, then fnmatch() shall return 0. If there is no match, fnmatch() shall return FNM_NOMATCH, which is defined in <fnmatch.h>. If an error occurs, fnmatch() shall return another non-zero value.
''[[BR]]

FNM_NOMATCH is defined in fnmatch.h as[[BR]]


{{{
#define	FNM_NOMATCH	1
}}}


but fnmatch() return 2 in case of string is not match to pattern. [[BR]]
Testcase attached here

----


{{{
#include <stdio.h>
#include <fnmatch.h>

int main()
{
	const char pat[]= ""a"";
	const char string[]= ""__nargin__"";
	int flags= FNM_PATHNAME|FNM_NOESCAPE|FNM_PERIOD;

	printf(""fnmatch(\""%s\"", \""%s\"", %d) return %d\n"", pat, string, flags,
		fnmatch(pat, string, flags) );
	
}


}}}
[[BR]]
Output should be like[[BR]]

{{{
fnmatch(""a"", ""__nargin__"", 7) return 1
}}}

While with current libc implementation it is[[BR]]

{{{
fnmatch(""a"", ""__nargin__"", 7) return 2
}}}


Working implementation can be taken here http://www.koders.com/c/fid9017D6D4B610AB3B4FB492C9229D41676C2FAA78.aspx?s=md5"	defect	closed	normal	libc-0.6.5	libc	0.6	normal	fixed		
