summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-05-05 13:26:39 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2018-05-05 13:45:10 -0700
commit5a13b159150bea1ebda8439ed018a3975f30786b (patch)
tree9b637df5adfac84d21e5a66bcaca70ce56b0688c
parentded6efa3da1ce611e4668d7766e934a239f6120c (diff)
Add missing braces around else clause in Read_Quoted()
Found by gcc 7.3: xprop.c: In function ‘Read_Quoted’: xprop.c:163:8: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] } else ^~~~ xprop.c:164:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ ptr++[0] = c; length--; ^~~~~~ Introduced in initial commit to X Consortium RCS in 1987: https://cgit.freedesktop.org/~alanc/xc-historical/commit/xc/programs/xprop/xprop.c?id=18ea83d7457743936e99a574b50e208f7697f096 Actual effect is minimal - for every \-escaped newline in the DFORMAT portion of a xprop formats file, xprop subtracted one byte too many from the count of bytes still available in the buffer, which could lead it to return an error of "Bad format file format: dformat too long." when there was still room left. Since the original buffer size was 10,000 bytes, and the current size is 500,000 bytes, it's unlikely anyone ever hit this in real usage. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xprop.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xprop.c b/xprop.c
index e7a66d9..88229e8 100644
--- a/xprop.c
+++ b/xprop.c
@@ -160,8 +160,9 @@ Read_Quoted (FILE *stream)
c = Read_Char(stream);
if (c == '\n') {
ptr--; length++;
- } else
+ } else {
ptr++[0] = c; length--;
+ }
}
}
ptr++[0] = '\0';