[stgt] [PATCH] Passing NULL to ldd_init() instead of illegal address

Roi Dayan roid at mellanox.com
Thu May 31 08:49:48 CEST 2012


ldd_init() was passed illegal address in case there were no non-option arguments

Signed-off-by: Roi Dayan <roid at mellanox.com>
---

Hi Tomo,

This is the same commit I just fixed the description in the commit since
it said the illegal address was passed when there are non-option args.

This patch fix the case where there were no non-option arguments and then
lld_init() was passed an illegal address.
I noticed that all non-option arguments are passed to each lld but not in use.
Maybe its something that can be removed?

Thanks,
Roi


 usr/tgtd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/usr/tgtd.c b/usr/tgtd.c
index 4ec6f23..cba2b66 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -487,6 +487,7 @@ int main(int argc, char **argv)
 {
 	struct sigaction sa_old;
 	struct sigaction sa_new;
+	char *spare_args;
 	int err, ch, longindex, nr_lld = 0;
 	int is_daemon = 1, is_debug = 0;
 	int ret;
@@ -549,7 +550,9 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	nr_lld = lld_init(argv[optind]);
+	spare_args = optind < argc ? argv[optind] : NULL;
+
+	nr_lld = lld_init(spare_args);
 	if (!nr_lld) {
 		fprintf(stderr, "No available low level driver!\n");
 		exit(1);
-- 
1.7.8.2

--
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