Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628979 > unrolled thread

[PATCH 4/5] trace-cmd: fix argument parsing minor BUG

Started byFederico Vaga <federico.vaga@vaga.pv.it>
First post2017-04-23 12:40 +0200
Last post2017-04-23 12:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/5] trace-cmd: fix argument parsing minor BUG Federico Vaga <federico.vaga@vaga.pv.it> - 2017-04-23 12:40 +0200

#1628979 — [PATCH 4/5] trace-cmd: fix argument parsing minor BUG

FromFederico Vaga <federico.vaga@vaga.pv.it>
Date2017-04-23 12:40 +0200
Subject[PATCH 4/5] trace-cmd: fix argument parsing minor BUG
Message-ID<tzn5T-7jm-5@gated-at.bofh.it>
For some reason the list command does not use anymore `getopt()`
to parse the arguments, instead it uses a custum implementation.

During this change [5da0eff trace-cmd: Add regex for listing of events]
the variable `optind` has been forgotten.

To reproduce the problem try to use invalid arguments. The application
will not report the correct invalid argument

$ ./trace-cmd list -a
list: invalid option -- 'i'

Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it>
---
 trace-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace-cmd.c b/trace-cmd.c
index 1a62faa..a05df92 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -706,7 +706,7 @@ int main (int argc, char **argv)
 					break;
 				default:
 					fprintf(stderr, "list: invalid option -- '%c'\n",
-						argv[optind][1]);
+						argv[i][1]);
 					usage(argv);
 				}
 			}
-- 
2.9.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web