RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [email protected]
  Module: rpm                              Date:   17-Oct-2009 15:10:05
  Branch: HEAD                             Handle: 2009101713100301

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               rpmrpc.c

  Log:
    - strip possible chroot prefix from db opened paths in Open(2)
    wrapper. LP#347749

  Summary:
    Revision    Changes     Path
    1.3138      +2  -0      rpm/CHANGES
    2.94        +8  -0      rpm/rpmio/rpmrpc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3137 -r1.3138 CHANGES
  --- rpm/CHANGES       2 Oct 2009 16:05:16 -0000       1.3137
  +++ rpm/CHANGES       17 Oct 2009 13:10:03 -0000      1.3138
  @@ -1,5 +1,7 @@
   
   5.2b1 -> 5.3a1
  +    - jbj/glen: strip possible chroot prefix from db opened paths in
  +     Open(2) wrapper. LP#347749
       - jbj: dbi: tear out the rpmdb->db_rebuilding construction scaffholding.
        DB->associate() cascaded callbacks to generate bulk secondary index key
        stores are now functional with --rebuilddb.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.93 -r2.94 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c        4 Oct 2009 22:47:42 -0000       2.93
  +++ rpm/rpmio/rpmrpc.c        17 Oct 2009 13:10:04 -0000      2.94
  @@ -249,6 +249,14 @@
        mode = 0644;
   #endif
       fdno = open(path, flags, mode);
  +    /* XXX if the open(2) fails, try to strip a possible chroot(2) prefix. */
  +    if (fdno < 0 && errno == ENOENT) {
  +     const char *dbpath = rpmExpand("%{?_dbpath}/", NULL);
  +     const char * fn = strstr(path + 1, dbpath);
  +     if (fn)
  +         fdno = open(fn, flags, mode);
  +     dbpath = _free(dbpath);
  +    }
       if (fdno >= 0) {
        if (fcntl(fdno, F_SETFD, FD_CLOEXEC) < 0) {
            (void) close(fdno);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to