From: Martin Mareš Date: Sun, 5 Apr 2026 17:18:47 +0000 (+0200) Subject: lspci, setpci: Warn when -s or -d is used multiple times X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=68774c70710825cd63a65e3522d91dfcace179ea;p=pciutils.git lspci, setpci: Warn when -s or -d is used multiple times --- diff --git a/lspci.c b/lspci.c index 2bfc236..68c9155 100644 --- a/lspci.c +++ b/lspci.c @@ -1135,11 +1135,15 @@ main(int argc, char **argv) pacc->buscentric = 1; break; case 's': + if (pci_filter_has_slot(&filter)) + fprintf(stderr, "Multiple -s options are given, only the last one has effect.\n"); if (msg = pci_filter_parse_slot(&filter, optarg)) die("-s: %s", msg); opt_filter = 1; break; case 'd': + if (pci_filter_has_id(&filter)) + fprintf(stderr, "Multiple -d options are given, only the last one has effect.\n"); if (msg = pci_filter_parse_id(&filter, optarg)) die("-d: %s", msg); opt_filter = 1; diff --git a/setpci.c b/setpci.c index b833250..e7f18ee 100644 --- a/setpci.c +++ b/setpci.c @@ -558,10 +558,14 @@ static int parse_filter(int argc, char **argv, int i, struct group *group) switch (c[1]) { case 's': + if (pci_filter_has_slot(&group->filter)) + fprintf(stderr, "Multiple -s options are given, only the last one has effect.\n"); if (d = pci_filter_parse_slot(&group->filter, d)) parse_err("Unable to parse filter -s %s", d); break; case 'd': + if (pci_filter_has_id(&group->filter)) + fprintf(stderr, "Multiple -d options are given, only the last one has effect.\n"); if (d = pci_filter_parse_id(&group->filter, d)) parse_err("Unable to parse filter -d %s", d); break;