Author: coolo Date: Sun Feb 24 16:21:16 2008 New Revision: 8891 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8891&view=rev Log: exit if there is an error opening the old solv Modified: trunk/sat-solver/tools/rpmdb2solv.c Modified: trunk/sat-solver/tools/rpmdb2solv.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/rpmdb2solv.c?rev=8891&r1=8890&r2=8891&view=diff ============================================================================== --- trunk/sat-solver/tools/rpmdb2solv.c (original) +++ trunk/sat-solver/tools/rpmdb2solv.c Sun Feb 24 16:21:16 2008 @@ -34,22 +34,27 @@ 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) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org