summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_install.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c
index 24b98f8..b073132 100644
--- a/src/logic/slbt_exec_install.c
+++ b/src/logic/slbt_exec_install.c
@@ -52,6 +52,7 @@ static int slbt_exec_install_init_dstdir(
struct argv_entry * last,
char * dstdir)
{
+ struct stat st;
char * slash;
size_t len;
@@ -69,8 +70,17 @@ static int slbt_exec_install_init_dstdir(
if (dstdir[--len] == '/')
dstdir[len] = '\0';
+ /* -t DSTDIR? */
+ if (dest)
+ return 0;
+
+ /* is DEST a directory? */
+ if (!(stat(dstdir,&st)))
+ if (S_ISDIR(st.st_mode))
+ return 0;
+
/* remove last path component */
- if (!dest && (slash = strrchr(dstdir,'/')))
+ if ((slash = strrchr(dstdir,'/')))
*slash = '\0';
return 0;