| Summary: | As sdm is given option --server=<number>, it always set id equal to 0 due to bug in code | ||
|---|---|---|---|
| Product: | [Tools] PTP | Reporter: | Jan Koñczak <jprofesorek> |
| Component: | Debug SDM | Assignee: | Greg Watson <g.watson> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | 5.0 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Fixed in head and 4.0 |
Build Identifier: Option --server=<id> not parsed correctly The --server option gets interpreted in file: src/impl/sdm_routing_table_file.c in function: sdm_routing_table_init Currently there is a check if the option starting chars match "--server" text. Then everything after 8th char is parsed as long. This means that eg. "=2" is parsed as long. Strtol fails, but the result gets unchecked and the default return value of 0 is taken as id. Solution: change to check for whole "--server=" option instead. Patch: =============================================================================== --- sdm_routing_table_file.c 2010-12-06 13:17:15.000000000 +0100 +++ sdm_routing_table_file_fix.c 2010-12-06 13:18:05.000000000 +0100 @@ -81,21 +81,21 @@ * * Server sdm's can also have their ID's set using the "--server=id" option. This * allows the servers to be started by a non-MPI runtime. */ for (ch = 0; ch < argc; ch++) { char * arg = argv[ch]; if (strncmp(arg, "--master", 8) == 0) { break; - } else if (strncmp(arg, "--server", 8) == 0) { - id = (int)strtol(arg+8, NULL, 10); + } else if (strncmp(arg, "--server=", 9) == 0) { + id = (int)strtol(arg+9, NULL, 10); } } =============================================================================== Reproducible: Always