From: наб <nabijaczleweli@xxxxxxxxxxxxxxxxxx> Subject: [PATCH] lsfd: error if extraneous argument given Date: Thu, 16 Mar 2023 17:08:59 +0100 > 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. > --- > misc-utils/lsfd.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c > index 27a0ada01..4b21bf6d2 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++) \ > -- > 2.30.2 Tested-by: Masatake YAMATO <yamato@xxxxxxxxxx>