summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-10-23 10:37:53 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-10-25 09:27:37 -0700
commit6cb02b166361200da35ba14f52cd9aaa493eb0ea (patch)
tree7402f4ed2f0f06b7a0b511ce0c0d8064a738b9fc
parent18a5278b008e9faa59b346fcab18a8d74b875fda (diff)
Xcms file parsing should not require the impossible to succeed
The field2 helper function, to split lines from Xcms.txt files into two tab delimited fields, contained a check: if ((*pBuf != '\n') || (*pBuf != '\0')) { return(XcmsFailure); which would cause it to return failure unless *pBuf had a value that was simultaneously equal to both \n & \0, and no one wants to live in a world where that could ever be true. This has gone unnoticed since 1991, since this only caused lines in Xcms.txt that started with whitespace to be rejected, but now gcc -Wlogicalop has brought it to our attention, and https://bugs.freedesktop.org/show_bug.cgi?id=70803 was filed. Now that we see it, and cannot unsee it, we change it to use the same logic as the check at other points in this function, to return failure only if we hit \n or \0 before we find the first non-whitespace character, so that lines starting with whitespace will have the space skipped over to get to the color name to be defined. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
-rw-r--r--src/xcms/cmsColNm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xcms/cmsColNm.c b/src/xcms/cmsColNm.c
index ecf19b37..ab6e4e87 100644
--- a/src/xcms/cmsColNm.c
+++ b/src/xcms/cmsColNm.c
@@ -314,7 +314,7 @@ field2(
/* Find Field 1 */
while (!isgraph(*pBuf)) {
- if ((*pBuf != '\n') || (*pBuf != '\0')) {
+ if ((*pBuf == '\n') || (*pBuf == '\0')) {
return(XcmsFailure);
}
if (isspace(*pBuf) || (*pBuf == delim)) {