[PATCH] Check return value of dup() in call_program()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux