summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-06-30 19:36:15 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-06-30 19:36:15 -0500
commit5931662b1ab7c15b5947798b5292b5c7a3ffb17a (patch)
treed4552be865368ebbb7b6f676aa679ed1e9bdda29 /src
parent3f9c2979ce886c6d23578eed4776b7d73fb1b10a (diff)
downloadvyatta-cfg-5931662b1ab7c15b5947798b5292b5c7a3ffb17a.tar.gz
vyatta-cfg-5931662b1ab7c15b5947798b5292b5c7a3ffb17a.zip
Bugfix 7259: check that out_stream is not null before attempting to write to it
Diffstat (limited to 'src')
-rw-r--r--src/cli_new.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index 274c602..6ba3910 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -2276,11 +2276,12 @@ system_out(char *cmd, const char *prepend_msg, boolean eloc)
}
/* XXX XXX XXX END emulating original "error" location handling */
-
- if (fwrite(out, count, 1, out_stream) != 1) {
- return -1;
+ if (out_stream != NULL) {
+ if (fwrite(out, count, 1, out_stream) != 1) {
+ return -1;
+ }
+ fflush(out_stream);
}
- fflush(out_stream);
} else if (sret == 0) {
/* timeout */
if (waitpid(cpid, &status, WNOHANG) == cpid) {
@@ -2293,7 +2294,7 @@ system_out(char *cmd, const char *prepend_msg, boolean eloc)
break;
}
}
- if (!prepend) {
+ if (!prepend && out_stream != NULL) {
fprintf(out_stream, "\n");
}
close(pfd[0]);