diff mbox series

[1/2] tst_rod: Use args[0] as the command name

Message ID 20220728114258.30832-1-mdoucha@suse.cz
State Accepted
Headers show
Series [1/2] tst_rod: Use args[0] as the command name | expand

Commit Message

Martin Doucha July 28, 2022, 11:42 a.m. UTC
Using argv[1] as the command name might fail if the first argument happens
to be I/O redirection. Use args[0] which is always the first argument not
processed by tst_rod.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/lib/tst_rod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Aug. 2, 2022, 2:49 p.m. UTC | #1
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Petr Vorel Aug. 16, 2022, 12:40 p.m. UTC | #2
Hi all,

FYI this first patch merged.
Thanks!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/lib/tst_rod.c b/testcases/lib/tst_rod.c
index 2f0ff902c..24c1fb668 100644
--- a/testcases/lib/tst_rod.c
+++ b/testcases/lib/tst_rod.c
@@ -130,7 +130,7 @@  int main(int argc, char *argv[])
 		}
 	}
 
-	execvp(argv[1], args);
+	execvp(args[0], args);
 
 	/* Fall back to shell if command wasn't found */
 	FILE *sin = popen("/bin/sh", "w");