Allow to use empty source and/or destination fields with --src-to-dst
option, in this case empty field will not be marked in comp_mask.
Examples: '--src-to-dst :48', '--src-to-dst 4:', '--src-to-dst :'.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
 infiniband-diags/src/saquery.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/infiniband-diags/src/saquery.c b/infiniband-diags/src/saquery.c
index db6ba11..1442902 100644
--- a/infiniband-diags/src/saquery.c
+++ b/infiniband-diags/src/saquery.c
@@ -1239,17 +1239,17 @@ main(int argc, char **argv)
                case 1:
                {
                        char *opt  = strdup(optarg);
-                       char *tok1 = strtok(opt, ":");
-                       char *tok2 = strtok(NULL, "\0");
-
-                       if (tok1 && tok2) {
-                               src = strdup(tok1);
-                               dst = strdup(tok2);
-                       } else {
+                       char *ch = strchr(opt, ':');
+                       if (!ch) {
                                fprintf(stderr,
                                        "ERROR: --src-to-dst <node>:<node>\n");
                                usage();
                        }
+                       *ch++ = '\0';
+                       if (*opt)
+                               src = strdup(opt);
+                       if (*ch)
+                               dst = strdup(ch);
                        free(opt);
                        query_type = IB_MAD_ATTR_PATH_RECORD;
                        break;
-- 
1.5.3.4.206.g58ba4

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to