Currently the buf pointer is advanced too far during each iteration.
Also terminate the string with a newline.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
buf += length;
while (cplen > 0) {
int l;
- length += sprintf (buf, "C%s", compat);
- buf += length;
+ l = sprintf (buf, "C%s", compat);
+ length += l;
+ buf += l;
l = strlen (compat) + 1;
compat += l;
cplen -= l;
}
+ length += sprintf(buf, "\n");
return length;
}