summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-16 22:07:34 +0100
committerAurelien Foret <aurelien@archlinux.org>2006-02-16 22:07:34 +0100
commiteefe29d99ae8dfbbbfcc45f2e7282c5645b20ad9 (patch)
treeb5f1b42f6d5069e96d050653d171587d786ed0d9 /lib/libalpm/util.c
parent181efcdeaaa5b7e65d8baeaee02451103a1c1224 (diff)
downloadpacman-eefe29d99ae8dfbbbfcc45f2e7282c5645b20ad9.tar.gz
pacman-eefe29d99ae8dfbbbfcc45f2e7282c5645b20ad9.tar.xz
fixed directory roots when running scriplets
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 6a256096..49580c36 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -405,7 +405,9 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
}
/* just in case our cwd was removed in the upgrade operation */
- chdir("/");
+ if(chdir(root) != 0) {
+ _alpm_log(PM_LOG_ERROR, "could not change directory to %s (%s)", root, strerror(errno));
+ }
_alpm_log(PM_LOG_FLOW2, "executing %s script...", script);
@@ -431,6 +433,10 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
_alpm_log(PM_LOG_ERROR, "could not change the root directory (%s)", strerror(errno));
return(1);
}
+ if(chdir("/") != 0) {
+ _alpm_log(PM_LOG_ERROR, "could not change directory to / (%s)", strerror(errno));
+ return(1);
+ }
umask(0022);
_alpm_log(PM_LOG_DEBUG, "executing \"%s\"", cmdline);
execl("/bin/sh", "sh", "-c", cmdline, (char *)0);