From cc85809e293b27a47f072ea6919f00e4ca2c423e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 30 Oct 2011 09:27:46 +0100 Subject: [PATCH] xbps-src: if euid can't write to masterdir, exit gracefully. --- xbps-src/xbps-src.sh.in | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index c49b090a06..718eed873c 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -215,11 +215,9 @@ check_config_vars() msg_error "'${f}' not set in configuration file!\n" fi done - if [ ! -d "$XBPS_MASTERDIR" ]; then - mkdir -p "$val" - if [ $? -ne 0 ]; then - msg_error "couldn't create 'XBPS_MASTERDIR' directory\n" - fi + if [ ! -w "$XBPS_MASTERDIR" ]; then + echo "ERROR: not enough perms for masterdir $XBPS_MASTERDIR.\n" + exit 1 fi [ -z "${_MASTERDIR_FLAG}" ] && export _MASTERDIR="$XBPS_MASTERDIR" }