aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-05-20 19:12:11 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-05-20 19:40:01 +0000
commitd7751071bc41c63c5dadd81ef4b0a26748d8f9b0 (patch)
tree18a4753d7a2128cc48a74d5b52567cde4f3df17a
parent5d698386fbfe166df72a17712ffde8cefeecefab (diff)
downloadsrc-d7751071bc41c63c5dadd81ef4b0a26748d8f9b0.tar.gz
src-d7751071bc41c63c5dadd81ef4b0a26748d8f9b0.zip
kldxref: do not error out if specified path is not directory, for -d mode
kldxref(8) is the only tool that can dump FreeBSD kernel module metadata, with the -d option. But the command line requirements for that are inconvenient, since parser requires that argv[1] is a directory containing whole set of modules to generate xref file. For -d, allow argv[0] to be a regular file, now it is possible to do e.g. $ kldxref -d /boot/kernel/ufs.ko to see only ufs.ko metadata. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30368
-rw-r--r--usr.sbin/kldxref/kldxref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c
index e1996862119a..7a4d704356b8 100644
--- a/usr.sbin/kldxref/kldxref.c
+++ b/usr.sbin/kldxref/kldxref.c
@@ -716,7 +716,7 @@ main(int argc, char *argv[])
if (stat(argv[0], &sb) != 0)
err(1, "%s", argv[0]);
- if ((sb.st_mode & S_IFDIR) == 0) {
+ if ((sb.st_mode & S_IFDIR) == 0 && !dflag) {
errno = ENOTDIR;
err(1, "%s", argv[0]);
}