mirror of
https://github.com/AuxXxilium/kmod.git
synced 2025-01-15 00:15:14 +07:00
depmod: deal with relative root dir
module paths coming from libkmod are absolute. Make sure we store the absolute dirname to compare later.
This commit is contained in:
parent
2e092e19a7
commit
e15a56af85
@ -2521,8 +2521,8 @@ static int do_depmod(int argc, char *argv[])
|
||||
{
|
||||
FILE *out = NULL;
|
||||
int err = 0, all = 0, maybe_all = 0, n_config_paths = 0;
|
||||
char *root = NULL;
|
||||
const char **config_paths = NULL;
|
||||
const char *root = "";
|
||||
const char *system_map = NULL;
|
||||
const char *module_symvers = NULL;
|
||||
const char *null_kmod_config = NULL;
|
||||
@ -2547,7 +2547,7 @@ static int do_depmod(int argc, char *argv[])
|
||||
maybe_all = 1;
|
||||
break;
|
||||
case 'b':
|
||||
root = optarg;
|
||||
root = path_make_absolute_cwd(optarg);
|
||||
break;
|
||||
case 'C': {
|
||||
size_t bytes = sizeof(char *) * (n_config_paths + 2);
|
||||
@ -2632,7 +2632,7 @@ static int do_depmod(int argc, char *argv[])
|
||||
|
||||
cfg.dirnamelen = snprintf(cfg.dirname, PATH_MAX,
|
||||
"%s" ROOTPREFIX "/lib/modules/%s",
|
||||
root, cfg.kversion);
|
||||
root == NULL ? "" : root, cfg.kversion);
|
||||
|
||||
if (optind == argc)
|
||||
all = 1;
|
||||
@ -2750,6 +2750,7 @@ depmod_init_failed:
|
||||
cmdline_failed:
|
||||
cfg_free(&cfg);
|
||||
free(config_paths);
|
||||
free(root);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user