projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0475211
)
dpctl: Exit unsuccessfully if a write to stdout or stderr failed.
author
Ben Pfaff
<blp@nicira.com>
Fri, 9 Jan 2009 00:56:50 +0000
(16:56 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Tue, 13 Jan 2009 01:00:28 +0000
(17:00 -0800)
A program should exit with an error if its output failed, so check for
this before termination.
Found by Chris Eagle via Fortify.
utilities/dpctl.c
patch
|
blob
|
history
diff --git
a/utilities/dpctl.c
b/utilities/dpctl.c
index c6de5a1e4a225e3c404c67a2c27e7bc9d26a1b35..0113d9674d4144a4292d47ef91c701b363be1222 100644
(file)
--- a/
utilities/dpctl.c
+++ b/
utilities/dpctl.c
@@
-123,6
+123,12
@@
int main(int argc, char *argv[])
p->name, p->max_args);
else {
p->handler(&s, argc, argv);
+ if (ferror(stdout)) {
+ ofp_fatal(0, "write to stdout failed");
+ }
+ if (ferror(stderr)) {
+ ofp_fatal(0, "write to stderr failed");
+ }
exit(0);
}
}