1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

pactree: Make error message smarter in register_syncs()

Our error message used to be very unclear when the configuration file
could not be found:

    $ ./pactree -lsr gtk
    error: failed to register sync DBs

Instead, display an accurate message and include the file name:

    $ ./pactree -lsr gtk
    error: config file /usr/local/etc/pacman.conf could not be read

Also, move the error message inside register_syncs() to allow for
differentiating between different errors that might require a handler in
the future.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Lukas Fleischer 2011-10-10 15:22:52 +02:00 committed by Dan McGee
parent fb401f569e
commit 8f414cd040

View File

@ -162,6 +162,7 @@ static int register_syncs(void) {
fp = fopen(configfile, "r");
if(!fp) {
fprintf(stderr, "error: config file %s could not be read\n", configfile);
return 1;
}
@ -463,7 +464,6 @@ int main(int argc, char *argv[])
if(searchsyncs) {
if(register_syncs() != 0) {
fprintf(stderr, "error: failed to register sync DBs\n");
ret = 1;
goto finish;
}