when a db doesn't exist, try to create it
authorewt <devnull@localhost>
Tue, 9 Jan 1996 21:51:53 +0000 (21:51 +0000)
committerewt <devnull@localhost>
Tue, 9 Jan 1996 21:51:53 +0000 (21:51 +0000)
CVS patchset: 189
CVS date: 1996/01/09 21:51:53

install.c

index fe7896f..a91f3a2 100644 (file)
--- a/install.c
+++ b/install.c
@@ -16,8 +16,13 @@ void doInstall(char * prefix, char * arg, int test, int installFlags) {
        mode = O_RDWR | O_EXCL;
        
     if (!rpmdbOpen(prefix, &db, mode, 0644)) {
-       fprintf(stderr, "error: cannot open %s/var/lib/rpm/packages.rpm\n", prefix);
-       exit(1);
+       /* try opening it O_CREAT */
+       mode |= O_CREAT;
+       if (!rpmdbOpen(prefix, &db, mode, 0644)) {
+           fprintf(stderr, "error: cannot open %s/var/lib/rpm/packages.rpm\n", 
+                       prefix);
+           exit(1);
+       }
     }
 
     message(MESS_DEBUG, "installing %s\n", arg);