[stgt] [PATCH] Check return value of dup() in call_program()
Arne Redlich
arne.redlich at googlemail.com
Wed Apr 20 22:25:28 CEST 2011
tgtd.c: In function ‘call_program’:
tgtd.c:306:4: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result
Signed-off-by: Arne Redlich <arne.redlich at googlemail.com>
---
usr/tgtd.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/usr/tgtd.c b/usr/tgtd.c
index bc74469..fd52ed5 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -302,7 +302,11 @@ int call_program(const char *cmd, void (*callback)(void *data, int result),
if (!pid) {
close(1);
- dup(fds[1]);
+ ret = dup(fds[1]);
+ if (ret < 0) {
+ eprintf("dup failed for: %s, %m\n", cmd);
+ exit(-1);
+ }
close(fds[0]);
execv(argv[0], argv);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list