summaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-10-26 11:35:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-10-26 11:35:34 +0000
commitcb25f35ed4db520b12ecd301c040a2202d91efbd (patch)
tree6738ad168bfffe004eb1e4dc9b72db36393e3435 /src/package.c
parent219a1b2ee8f4c3c2caf57e79bcb9780e32da7155 (diff)
downloadapk-tools-cb25f35ed4db520b12ecd301c040a2202d91efbd.tar.gz
apk-tools-cb25f35ed4db520b12ecd301c040a2202d91efbd.tar.bz2
apk-tools-cb25f35ed4db520b12ecd301c040a2202d91efbd.tar.xz
apk-tools-cb25f35ed4db520b12ecd301c040a2202d91efbd.zip
give more helpful error messages
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/package.c b/src/package.c
index 5cde906..2f14c80 100644
--- a/src/package.c
+++ b/src/package.c
@@ -9,6 +9,7 @@
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
+#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdio.h>
@@ -354,9 +355,11 @@ int apk_pkg_run_script(struct apk_package *pkg, int root_fd,
if (pid == -1)
return -1;
if (pid == 0) {
- chroot(".");
- execle(fn, script_types[script->type],
- pkg->version, "", NULL, environment);
+ if (chroot(".") < 0) {
+ apk_error("chroot: %s", strerror(errno));
+ } else
+ execle(fn, script_types[script->type],
+ pkg->version, "", NULL, environment);
exit(1);
}
waitpid(pid, &status, 0);