diff --git a/compctl.c b/compctl.c index 684f16298e00e7eab03e5be532b8a14b6c8b67f4..093bb88bf6236ba748f4fd71596045b80da7730c 100644 --- a/compctl.c +++ b/compctl.c @@ -63,7 +63,7 @@ run(int argc, char *argv[]) fgets(line, sizeof(line), f); fclose(f); if (line[0] != '1') { - fputs(line, stderr); + fputs(*line ? line : "unexpected hangup\n", stderr); return EXIT_FAILURE; } @@ -96,7 +96,7 @@ stop(pid_t pid) fgets(line, sizeof(line), f); fclose(f); if (line[0] != '1') { - fputs(line, stderr); + fputs(*line ? line : "unexpected hangup\n", stderr); exit(EXIT_FAILURE); } } @@ -110,7 +110,7 @@ stop_all(void) fgets(line, sizeof(line), f); fclose(f); if (line[0] != '1') { - fputs(line, stderr); + fputs(*line ? line : "unexpected hangup\n", stderr); exit(EXIT_FAILURE); } fputs(line + 2, stdout); @@ -126,7 +126,7 @@ limit_mem(size_t limit) fclose(f); if (line[0] != '1') { /* TODO: Error message postprocessing. */ - fputs(line, stderr); + fputs(*line ? line : "unexpected hangup\n", stderr); exit(EXIT_FAILURE); } }