From: наб Date: Thu, 16 Mar 2023 16:08:59 +0000 (+0100) Subject: lsfd: error if extraneous argument given X-Git-Tag: v2.39-rc2~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a2d7c4725ad895fc1cd3f473e193352118fd4b0;p=thirdparty%2Futil-linux.git lsfd: error if extraneous argument given The manual and help string both spec lsfd [options]; actually stick to that instead of ignoring subsequent arguments. This is particularly a weird thing to allow given that lsof path is legal and does something (either same as lsfd -Q "MAJ:MIN == \"$(stat -c %Hd:%Ld path)\"" if it's a mountpoint or lsfd -Q "NAME ~= '$path'" (sans the regex and escaping) otherwise). This mirrors ec96a89ed9551ffacfc58b3056c8070444e3a2f3 for largely the same reason. Signed-off-by: Karel Zak Tested-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index 122bef9fa8..0337f1975c 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -1943,6 +1943,8 @@ int main(int argc, char *argv[]) errtryhelp(EXIT_FAILURE); } } + if (argv[optind]) + errtryhelp(EXIT_FAILURE); #define INITIALIZE_COLUMNS(COLUMN_SPEC) \ for (i = 0; i < ARRAY_SIZE(COLUMN_SPEC); i++) \