git: 03cfd91998ac - main - devmatch: Make -a work for all devices

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 05 Apr 2024 22:57:51 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=03cfd91998ac017acd3102a184e194d42e50f843

commit 03cfd91998ac017acd3102a184e194d42e50f843
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-04-05 22:31:55 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-05 22:53:47 +0000

    devmatch: Make -a work for all devices
    
    devmatch -a should produce output for all attached devices, but doesn't.
    
    Noticed by:             cperciva
    Sponsored by:           Netflix
---
 sbin/devmatch/devmatch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c
index d93a35e5633d..6124794d113a 100644
--- a/sbin/devmatch/devmatch.c
+++ b/sbin/devmatch/devmatch.c
@@ -406,7 +406,7 @@ search_hints(const char *bus, const char *dev, const char *pnpinfo)
 				else if (!notme) {
 					if (!unbound_flag) {
 						if (all_flag)
-							printf("%s: %s", *dev ? dev : "unattached", lastmod);
+							printf("%s: %s\n", *dev ? dev : "unattached", lastmod);
 						else
 							printf("%s\n", lastmod);
 						if (verbose_flag)
@@ -445,7 +445,7 @@ find_unmatched(struct devinfo_dev *dev, void *arg)
 			break;
 		if (!(dev->dd_flags & DF_ENABLED))
 			break;
-		if (dev->dd_flags & DF_ATTACHED_ONCE)
+		if (!all_flag && dev->dd_flags & DF_ATTACHED_ONCE)
 			break;
 		parent = devinfo_handle_to_device(dev->dd_parent);
 		bus = strdup(parent->dd_name);