There's a function to test string equivalence...
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 16 Sep 2009 11:08:28 +0000 (14:08 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 16 Sep 2009 12:47:11 +0000 (15:47 +0300)
lib/backend/db3.c
lib/backend/sqlite.c

index db4ff14..602ec1a 100644 (file)
@@ -195,7 +195,7 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
            char * tmpdir;
 
            root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-           if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
+           if (rstreq(root, "/") || rpmdb->db_chrootDone)
                root = NULL;
            tmpdir = rpmGenPath(root, dbi->dbi_tmpdir, NULL);
            xx = dbenv->set_tmp_dir(dbenv, tmpdir);
@@ -464,7 +464,7 @@ static int db3close(dbiIndex dbi, unsigned int flags)
      * Get the prefix/root component and directory path.
      */
     root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-    if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
+    if (rstreq(root, "/") || rpmdb->db_chrootDone)
        root = NULL;
     home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
 
@@ -596,7 +596,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
      * Get the prefix/root component and directory path.
      */
     root = (dbi->dbi_root ? dbi->dbi_root : rpmdb->db_root);
-    if ((root[0] == '/' && root[1] == '\0') || rpmdb->db_chrootDone)
+    if (rstreq(root, "/") || rpmdb->db_chrootDone)
        root = NULL;
     home = (dbi->dbi_home ? dbi->dbi_home : rpmdb->db_home);
 
index a47c569..d5af844 100644 (file)
@@ -102,7 +102,7 @@ static void enterChroot(dbiIndex dbi)
 {
     int xx;
 
-    if ((dbi->dbi_root[0] == '/' && dbi->dbi_root[1] == '\0') || dbi->dbi_rpmdb->db_chrootDone || sqlInRoot)
+    if (rstreq(dbi->dbi_root, "/") || dbi->dbi_rpmdb->db_chrootDone || sqlInRoot)
        /* Nothing to do, was not already in chroot */
        return;
 
@@ -120,7 +120,7 @@ static void leaveChroot(dbiIndex dbi)
 {
     int xx;
 
-    if ((dbi->dbi_root[0] == '/' && dbi->dbi_root[1] == '\0') || dbi->dbi_rpmdb->db_chrootDone || !sqlInRoot)
+    if (rstreq(dbi->dbi_root, "/") || dbi->dbi_rpmdb->db_chrootDone || !sqlInRoot)
        /* Nothing to do, not in chroot */
        return;