Skip to content
Snippets Groups Projects
Commit 6dd3914e authored by Petr Baudis's avatar Petr Baudis
Browse files

compctl: Proper newline termination of messages

parent a1a8e13f
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,7 @@ run(int argc, char *argv[]) ...@@ -99,7 +99,7 @@ run(int argc, char *argv[])
{ {
char *line = daemon_chat("blessme"); char *line = daemon_chat("blessme");
if (line[0] != '1') { if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr); fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
free(line); free(line);
...@@ -130,7 +130,7 @@ stop(pid_t pid) ...@@ -130,7 +130,7 @@ stop(pid_t pid)
char cmd[256]; snprintf(cmd, sizeof(cmd), "stop %d", pid); char cmd[256]; snprintf(cmd, sizeof(cmd), "stop %d", pid);
char *line = daemon_chat(cmd); char *line = daemon_chat(cmd);
if (line[0] != '1') { if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr); fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
free(line); free(line);
...@@ -141,10 +141,10 @@ stop_all(void) ...@@ -141,10 +141,10 @@ stop_all(void)
{ {
char *line = daemon_chat("stopall"); char *line = daemon_chat("stopall");
if (line[0] != '1') { if (line[0] != '1') {
fputs(*line ? line : "unexpected hangup\n", stderr); fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
fputs(line + 2, stdout); puts(line + 2);
free(line); free(line);
} }
...@@ -155,7 +155,7 @@ limit_mem(size_t limit) ...@@ -155,7 +155,7 @@ limit_mem(size_t limit)
char *line = daemon_chat(cmd); char *line = daemon_chat(cmd);
if (line[0] != '1') { if (line[0] != '1') {
/* TODO: Error message postprocessing. */ /* TODO: Error message postprocessing. */
fputs(*line ? line : "unexpected hangup\n", stderr); fprintf(stderr, "%s\n", *line ? line : "unexpected hangup");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
free(line); free(line);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment