diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-10-05 04:36:25 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-10-05 04:36:25 +0200 |
commit | 4853a4aad97fe36f9237ffb7356201adab507a1c (patch) | |
tree | 047da7b42849e5415d1a377091794ec80f93276a /lib/libalpm/trans.c | |
parent | 98bcd1f5b1023b9eb219589c809fb2505079965d (diff) | |
download | pacman-4853a4aad97fe36f9237ffb7356201adab507a1c.tar.gz pacman-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.c | 7 |
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)) { |