The previous version of sysctl had the form: sysctl -p [file] In other words, it required a space between the -p and the [file]. Omitting the space would lead to an error. The new version though is the opposite: sysctl -p[file] In other words, it requires there to not be a space. Considering the old behavior has been around for a decade, and runtime checking for this mismatch in behavior is silly, and supporting the old syntax is trivial, add support for it. Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx> --- v2 - fix thinko bug added in the last minute when testing more edge cases sysctl.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sysctl.c b/sysctl.c index 587e26d..74d1c93 100644 --- a/sysctl.c +++ b/sysctl.c @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) bool preloadfileOpt = false; int ReturnCode = 0; int c; - const char *preloadfile = DEFAULT_PRELOAD; + const char *preloadfile = NULL; enum { DEPRECATED_OPTION = CHAR_MAX + 1, @@ -744,13 +744,20 @@ int main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (DisplayAllOpt) return DisplayAll(PROC_PATH); - if (preloadfileOpt) + if (preloadfileOpt) { + if (!preloadfile) { + if (argc) + preloadfile = argv[0]; + else + preloadfile = DEFAULT_PRELOAD; + } return Preload(preloadfile); - - argc -= optind; - argv += optind; + } if (argc < 1) xerrx(EXIT_FAILURE, _("no variables specified\n" -- 1.7.9.7