summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Kulow <coolo@suse.de>2008-02-24 15:21:16 +0000
committerStephan Kulow <coolo@suse.de>2008-02-24 15:21:16 +0000
commitb0d38be0d0db668b38c28830320f77797e7b6385 (patch)
tree6e30f28671d7e14e92e797b08f84b0df8209550a
parentd1e9f0761e0130818ab6c26d7ec5438cc78ffe57 (diff)
downloadlibsolv-b0d38be0d0db668b38c28830320f77797e7b6385.tar.gz
libsolv-b0d38be0d0db668b38c28830320f77797e7b6385.tar.bz2
libsolv-b0d38be0d0db668b38c28830320f77797e7b6385.zip
exit if there is an error opening the old solv
-rw-r--r--tools/rpmdb2solv.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c
index 44a537f..e818e11 100644
--- a/tools/rpmdb2solv.c
+++ b/tools/rpmdb2solv.c
@@ -34,22 +34,27 @@ main(int argc, char **argv)
int g;
const char *root = "/";
- while ((g = getopt (argc, argv, "-r:")) >= 0)
+ while ((g = getopt (argc, argv, "r:")) >= 0)
switch (g)
{
case 'r': root = optarg; break;
- case 1:
- refpool = pool;
- if ((fp = fopen(argv[1], "r")) == NULL)
- {
- perror(argv[1]);
- exit(0);
- }
- ref = repo_create(refpool, "ref");
- repo_add_solv(ref, fp);
- fclose(fp);
+ default:
+ exit(1);
}
+ if (optind < argc)
+ {
+ refpool = pool;
+ if ((fp = fopen(argv[optind], "r")) == NULL)
+ {
+ perror(argv[optind]);
+ exit(1);
+ }
+ ref = repo_create(refpool, "ref");
+ repo_add_solv(ref, fp);
+ fclose(fp);
+ }
+
repo = repo_create(pool, "installed");
repo_add_rpmdb(repo, ref, root);
if (ref)