fcoeadm --interface without providing any additional arguments
results in an error:
./fcoeadm: option '--interface' requires an argument
However, fcoeadm -i displays all the interfaces correctly.
Signed-off-by: Steve Ma <[email protected]>
---
fcoeadm.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fcoeadm.c b/fcoeadm.c
index 5af7bbe..8001165 100644
--- a/fcoeadm.c
+++ b/fcoeadm.c
@@ -43,7 +43,7 @@ static struct option fcoeadm_opts[] = {
{"create", 1, 0, 'c'},
{"destroy", 1, 0, 'd'},
{"reset", 1, 0, 'r'},
- {"interface", 1, 0, 'i'},
+ {"interface", 2, 0, 'i'},
{"target", 2, 0, 't'},
{"lun", 2, 0, 'l'},
{"stats", 1, 0, 's'},
@@ -476,9 +476,11 @@ int main(int argc, char *argv[])
goto error;
s = NULL;
if (argc == 2) {
- if (argv[1][1] == '-')
- s = strchr(argv[1], '=')+1;
- else
+ if (argv[1][1] == '-') {
+ s = strchr(argv[1], '=');
+ if (s)
+ s += 1;
+ } else
s = argv[1]+2;
} else
s = argv[2];
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel