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

compctl: Print 'Unexpected hangup' if no reply is received

parent 1181c4cc
No related branches found
No related tags found
No related merge requests found
...@@ -63,7 +63,7 @@ run(int argc, char *argv[]) ...@@ -63,7 +63,7 @@ run(int argc, char *argv[])
fgets(line, sizeof(line), f); fgets(line, sizeof(line), f);
fclose(f); fclose(f);
if (line[0] != '1') { if (line[0] != '1') {
fputs(line, stderr); fputs(*line ? line : "unexpected hangup\n", stderr);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
...@@ -96,7 +96,7 @@ stop(pid_t pid) ...@@ -96,7 +96,7 @@ stop(pid_t pid)
fgets(line, sizeof(line), f); fgets(line, sizeof(line), f);
fclose(f); fclose(f);
if (line[0] != '1') { if (line[0] != '1') {
fputs(line, stderr); fputs(*line ? line : "unexpected hangup\n", stderr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
...@@ -110,7 +110,7 @@ stop_all(void) ...@@ -110,7 +110,7 @@ stop_all(void)
fgets(line, sizeof(line), f); fgets(line, sizeof(line), f);
fclose(f); fclose(f);
if (line[0] != '1') { if (line[0] != '1') {
fputs(line, stderr); fputs(*line ? line : "unexpected hangup\n", stderr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
fputs(line + 2, stdout); fputs(line + 2, stdout);
...@@ -126,7 +126,7 @@ limit_mem(size_t limit) ...@@ -126,7 +126,7 @@ limit_mem(size_t limit)
fclose(f); fclose(f);
if (line[0] != '1') { if (line[0] != '1') {
/* TODO: Error message postprocessing. */ /* TODO: Error message postprocessing. */
fputs(line, stderr); fputs(*line ? line : "unexpected hangup\n", stderr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment