Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: unlisted-recipients:; (no To-header on input)
Cc: util-linux@vger.kernel.org
Subject: [PATCH] lsfd: error if extraneous argument given
Date: Thu, 16 Mar 2023 17:08:59 +0100	[thread overview]
Message-ID: <20230316160859.zksrhccvnnslkgyd@tarta.nabijaczleweli.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2023-03-16 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 16:08 наб [this message]
2023-03-16 20:32 ` [PATCH] lsfd: error if extraneous argument given Masatake YAMATO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230316160859.zksrhccvnnslkgyd@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).