Merge pull request #341 from libexpat/xmlwf-fix-exit-code

xmlwf: Fix exit code for case without "-d DIRECTORY"
This commit is contained in:
Sebastian Pipping 2019-09-07 02:58:20 +02:00 committed by GitHub
commit c672abcfea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View file

@ -12,6 +12,14 @@ Release x.x.x xxx xxx xx xxxx
Bug fixes:
#240 Fix cases where XML_StopParser did not have any effect
when called from inside of an end element handler
#341 xmlwf: Fix exit code for operation without "-d DIRECTORY";
previously, only "-d DIRECTORY" would give you a proper
exit code:
# xmlwf -d . <<<'<not well-formed>' 2>/dev/null ; echo $?
2
# xmlwf <<<'<not well-formed>' 2>/dev/null ; echo $?
0
Now both cases return exit code 2.
Other changes:
#325 Windows: Drop support for Visual Studio <=7.1/2003

View file

@ -39,9 +39,7 @@ DIFF="${MYDIR}/udiffer.py"
RunXmlwfNotWF() {
file="$1"
reldir="$2"
$XMLWF -p "$file" > outfile || return $?
read outdata < outfile
if test "$outdata" = "" ; then
if $XMLWF -p "$file" > /dev/null; then
echo "Expected not well-formed: $reldir$file"
return 1
else
@ -132,7 +130,6 @@ for xmldir in ibm/not-wf/P* \
RunXmlwfNotWF "$xmlfile" "$xmldir/"
UpdateStatus $?
done
rm outfile
done
cd "$TS/xmlconf/oasis"
@ -140,7 +137,6 @@ for xmlfile in *fail*.xml ; do
RunXmlwfNotWF "$xmlfile" "oasis/"
UpdateStatus $?
done
rm outfile
echo "Passed: $SUCCESS"
echo "Failed: $ERROR"

View file

@ -1114,11 +1114,13 @@ tmain(int argc, XML_Char **argv) {
fclose(userData.fp);
if (! result) {
tremove(outName);
exit(2);
}
free(outName);
}
XML_ParserFree(parser);
if (! result) {
exit(2);
}
}
return 0;
}