diff -pru pacman-2.9.5/src/pacman.c pacman-2.9.5-ldconfig/src/pacman.c --- pacman-2.9.5/src/pacman.c 2005-01-12 00:14:16.000000000 +0100 +++ pacman-2.9.5-ldconfig/src/pacman.c 2005-05-20 19:38:48.000000000 +0200 @@ -112,6 +112,7 @@ char *workfile = NULL; enum {READ_ONLY, READ_WRITE} pm_access; int maxcols = 80; int neednl = 0; /* for cleaner message output */ +int runldconfig = 0; int main(int argc, char *argv[]) { @@ -2051,17 +2052,7 @@ int pacman_add(pacdb_t *db, PMList *targ } FREELIST(alltargs); - /* run ldconfig if it exists */ - snprintf(expath, PATH_MAX, "%setc/ld.so.conf", pmo_root); - if(!stat(expath, &buf)) { - snprintf(expath, PATH_MAX, "%ssbin/ldconfig", pmo_root); - if(!stat(expath, &buf)) { - char cmd[PATH_MAX]; - snprintf(cmd, PATH_MAX, "%s -r %s", expath, pmo_root); - vprint("running \"%s\"\n", cmd); - system(cmd); - } - } + runldconfig = 1; return(ret); } @@ -2315,17 +2306,7 @@ int pacman_remove(pacdb_t *db, PMList *t FREELISTPKGS(alltargs); - /* run ldconfig if it exists */ - snprintf(line, PATH_MAX, "%setc/ld.so.conf", pmo_root); - if(!stat(line, &buf)) { - snprintf(line, PATH_MAX, "%ssbin/ldconfig", pmo_root); - if(!stat(line, &buf)) { - char cmd[PATH_MAX]; - snprintf(cmd, PATH_MAX, "%s -r %s", line, pmo_root); - vprint("running \"%s\"\n", cmd); - system(cmd); - } - } + runldconfig = 1; return(0); } @@ -3880,6 +3861,18 @@ int lckrm(char *file) return(unlink(file)); } +void ldconfig(void) +{ + if (fork() == 0){ + char expath[PATH_MAX]; + snprintf(expath, PATH_MAX, "%ssbin/ldconfig", pmo_root); + execl(expath, "-r", pmo_root, NULL); + /* this should never be reached */ + printf("ERROR: running ldconfig failed!\n"); + exit(1); + } +} + void cleanup(int signum) { PMList *lp; @@ -3899,6 +3892,10 @@ void cleanup(int signum) fclose(logfd); } + if (runldconfig){ + ldconfig(); + } + /* free memory */ for(lp = pmc_syncs; lp; lp = lp->next) { sync_t *sync = (sync_t *)lp->data; diff -pru pacman-2.9.5/src/pacman.h pacman-2.9.5-ldconfig/src/pacman.h --- pacman-2.9.5/src/pacman.h 2005-01-12 00:14:16.000000000 +0100 +++ pacman-2.9.5-ldconfig/src/pacman.h 2005-05-20 16:01:17.000000000 +0200 @@ -59,6 +59,7 @@ int yesno(char* fmt, ...); int lckmk(char *file, int retries, unsigned int sleep_secs); int lckrm(char *lckfile); void cleanup(int signum); +void ldconfig(void); #endif /* PACMAN_H */