Skip to content

Commit

Permalink
depmod: Do not accept relative moduledir
Browse files Browse the repository at this point in the history
This makes for a confusing interface, particularly considering that -b
can also be set, with or without a trailing slash.

Since the build system already enforces an absolute path, do the same when
passing it via command line, avoiding the following error:

	$ sudo ln -s /lib/modules /foobar
	$ depmod -m foobar -o /tmp/result2 6.11.7
	depmod: ERROR: could not open directory foobar/6.11.7: No such file or directory
	depmod: FATAL: could not search modules: No such file or directory

Signed-off-by: Lucas De Marchi <[email protected]>
  • Loading branch information
lucasdemarchi committed Nov 14, 2024
1 parent 5454f18 commit 861283b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,11 @@ static int do_depmod(int argc, char *argv[])
}
break;
case 'm':
if (optarg[0] != '/') {
ERR("invalid module directory '%s': absolute path required",
optarg);
goto cmdline_failed;
}
module_directory = optarg;
break;
case 'o':
Expand Down

0 comments on commit 861283b

Please sign in to comment.