|
@@ -235,8 +235,11 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (quiet)
|
|
|
- outfd = fopen("/dev/null", "w");
|
|
|
+ if (quiet) {
|
|
|
+ FILE *tmpfd = NULL;
|
|
|
+ if ((tmpfd = fopen("/dev/null", "w")))
|
|
|
+ outfd = tmpfd;
|
|
|
+ }
|
|
|
shell = clish_shell_new(NULL, outfd, stop_on_error);
|
|
|
if (!shell) {
|
|
|
fprintf(stderr, "Error: Can't run clish.\n");
|
|
@@ -344,7 +347,7 @@ end:
|
|
|
}
|
|
|
clish_shell_delete(shell);
|
|
|
}
|
|
|
- if (quiet)
|
|
|
+ if (quiet && (outfd != stdout))
|
|
|
fclose(outfd);
|
|
|
|
|
|
|