pacman-conf.c: exit if cannot set rootdir or parse config file
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
0e260f9335
commit
c968e625e8
1 changed files with 7 additions and 1 deletions
|
@ -77,7 +77,11 @@ static void parse_opts(int argc, char **argv)
|
||||||
config_file = optarg;
|
config_file = optarg;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
config->rootdir = strdup(optarg);
|
if ((config->rootdir = strdup(optarg)) == NULL) {
|
||||||
|
fprintf(stderr, "error setting rootdir '%s': out of memory\n", optarg);
|
||||||
|
cleanup();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
repo_list = 1;
|
repo_list = 1;
|
||||||
|
@ -105,6 +109,8 @@ static void parse_opts(int argc, char **argv)
|
||||||
|
|
||||||
if(parseconfigfile(config_file) != 0 || setdefaults(config) != 0) {
|
if(parseconfigfile(config_file) != 0 || setdefaults(config) != 0) {
|
||||||
fprintf(stderr, "error parsing '%s'\n", config_file);
|
fprintf(stderr, "error parsing '%s'\n", config_file);
|
||||||
|
cleanup();
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue