Skip to content

Commit

Permalink
Eliminate use of rpmCleanPath() in relocation code
Browse files Browse the repository at this point in the history
No functional changes.
  • Loading branch information
pmatilai committed Nov 12, 2024
1 parent 1af4761 commit ed3e1ef
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/relocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <rpm/rpmstring.h>

#include "rpmfs.hh"
#include "rpmmacro_internal.hh"
#include "misc.hh"

#include "debug.h"
Expand Down Expand Up @@ -319,16 +320,16 @@ assert(fn != NULL); /* XXX can't happen */
continue;

if (relocations[j].newPath) { /* Relocate the path */
char *t = NULL;
rstrscat(&t, relocations[j].newPath, (dirNames[i] + len), NULL);
/* Unfortunately rpmCleanPath strips the trailing slash.. */
(void) rpmCleanPath(t);
rstrcat(&t, "/");

rpmlog(RPMLOG_DEBUG,
"relocating directory %s to %s\n", dirNames[i], t);
std::string t = rpm::join_path( { relocations[j].newPath,
(dirNames[i] + len) },
false);
/* join_path() strips the trailing slash, add it back */
t += '/';

rpmlog(RPMLOG_DEBUG, "relocating directory %s to %s\n",
dirNames[i], t.c_str());
free(dirNames[i]);
dirNames[i] = t;
dirNames[i] = xstrdup(t.c_str());
nrelocated++;
}
}
Expand Down

0 comments on commit ed3e1ef

Please sign in to comment.