Commit 90518bfc authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Return of snprintf is not the number of written bytes

parent f49f5458
...@@ -414,11 +414,16 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) { ...@@ -414,11 +414,16 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
if (indent & (1U << i)) if (indent & (1U << i))
maxIndent = i+1; maxIndent = i+1;
for (int i = 0; i < maxIndent - 1; i++) { for (int i = 0; i < maxIndent - 1; i++) {
int written; int written, ret;
if (indent & (1 << i)) if (indent & (1 << i))
written = snprintf(buf, n, "%s ", CRT_treeStr[TREE_STR_VERT]); ret = snprintf(buf, n, "%s ", CRT_treeStr[TREE_STR_VERT]);
else else
written = snprintf(buf, n, " "); ret = snprintf(buf, n, " ");
if (ret < 0 || ret >= n) {
written = n;
} else {
written = ret;
}
buf += written; buf += written;
n -= written; n -= written;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment