summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2007-10-04 21:36:25 -0500
committerAaron Griffin <aaronmgriffin@gmail.com>2007-10-04 21:36:25 -0500
commit4853a4aad97fe36f9237ffb7356201adab507a1c (patch)
tree047da7b42849e5415d1a377091794ec80f93276a /lib/libalpm/trans.c
parent98bcd1f5b1023b9eb219589c809fb2505079965d (diff)
downloadpacman-4853a4aad97fe36f9237ffb7356201adab507a1c.tar.xz
Fail loudly is scriptlets cannot be run via /bin/sh
If /bin/sh is missing in the root directory, scriptlets cannot be executed, as we're explicitly calling it. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 9eb27c30..462b4d8b 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -552,6 +552,13 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
return(0);
}
+ snprintf(tmpdir, PATH_MAX, "%sbin/sh", root);
+ if(stat(tmpdir, &buf)) {
+ /* not found */
+ _alpm_log(PM_LOG_ERROR, _("No /bin/sh in root dir (%s), aborting scriptlet\n"), root);
+ return(0);
+ }
+
if(!strcmp(script, "pre_upgrade") || !strcmp(script, "pre_install")) {
snprintf(tmpdir, PATH_MAX, "%stmp/", root);
if(stat(tmpdir, &buf)) {