Commit 6dd3914e authored by Petr Baudis's avatar Petr Baudis
Browse files

compctl: Proper newline termination of messages

parent a1a8e13f
......@@ -99,7 +99,7 @@ run(int argc, char *argv[])
{
char *line = daemon_chat("blessme");
if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr);
fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
return EXIT_FAILURE;
}
free(line);
......@@ -130,7 +130,7 @@ stop(pid_t pid)
char cmd[256]; snprintf(cmd, sizeof(cmd), "stop %d", pid);
char *line = daemon_chat(cmd);
if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr);
fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE);
}
free(line);
......@@ -141,10 +141,10 @@ stop_all(void)
{
char *line = daemon_chat("stopall");
if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr);
fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE);
}
fputs(line + 2, stdout);
puts(line + 2);
free(line);
}
......@@ -155,7 +155,7 @@ limit_mem(size_t limit)
char *line = daemon_chat(cmd);
if (line[0] != '1') {
/* TODO: Error message postprocessing. */
fputs(*line ? line : "unexpected hangup\n", stderr);
fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE);
}
free(line);
......
Supports Markdown
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