[git commit] nsenter: stop option parsing on 1st non-option

Denys Vlasenko vda.linux at googlemail.com
Sat Dec 12 07:44:32 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=ef2366cdca45941f943f4970ac57a4008181fca9
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

"nsenter ls -l" gives: invalid option -- 'l'

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 findutils/find.c     | 2 +-
 util-linux/nsenter.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/findutils/find.c b/findutils/find.c
index a8c3fa346..34e11ae26 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -1522,7 +1522,7 @@ int find_main(int argc UNUSED_PARAM, char **argv)
 	}
 	*past_HLP = NULL;
 	/* "+": stop on first non-option */
-	i = getopt32(argv, "+HLP");
+	i = getopt32(argv, "+""HLP");
 	if (i & (1<<0))
 		G.recurse_flags |= ACTION_FOLLOWLINKS_L0 | ACTION_DANGLING_OK;
 	if (i & (1<<1))
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index c48dcf885..9cfbf21e4 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -103,8 +103,9 @@ static const struct namespace_descr ns_list[] = {
 };
 /*
  * Upstream nsenter doesn't support the short option for --preserve-credentials
+ * "+": stop on first non-option
  */
-static const char opt_str[] ALIGN1 = "U::i::u::n::p::m::""t:+S:+G:+r::w::F";
+static const char opt_str[] ALIGN1 = "+""U::i::u::n::p::m::""t:+S:+G:+r::w::F";
 
 #if ENABLE_LONG_OPTS
 static const char nsenter_longopts[] ALIGN1 =


More information about the busybox-cvs mailing list