Remove copy-paste currentDirectory() from sqlite, use rpmGetCwd()
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 4 Apr 2008 06:55:30 +0000 (09:55 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 4 Apr 2008 06:55:30 +0000 (09:55 +0300)
rpmdb/sqlite.c

index 1d51c58..5f30b95 100644 (file)
@@ -98,7 +98,6 @@ static int sqlInRoot = 0;
 static void enterChroot(dbiIndex dbi)
 {
     int xx;
-    char * currDir = NULL; 
 
     if ((dbi->dbi_root[0] == '/' && dbi->dbi_root[1] == '\0') || dbi->dbi_rpmdb->db_chrootDone || sqlInRoot)
        /* Nothing to do, was not already in chroot */
@@ -107,17 +106,7 @@ static void enterChroot(dbiIndex dbi)
 if (_debug)
 fprintf(stderr, "sql:chroot(%s)\n", dbi->dbi_root);
 
-    {
-      int currDirLen = 0;
-
-      do {
-        currDirLen += 128;
-        currDir = xrealloc(currDir, currDirLen);
-        memset(currDir, 0, currDirLen);
-      } while (getcwd(currDir, currDirLen) == NULL && errno == ERANGE);
-    }
-
-    sqlCwd = currDir;
+    sqlCwd = rpmGetCwd();
     xx = chdir("/");
     xx = chroot(dbi->dbi_root);
 assert(xx == 0);