From 061d4ac5055c2d5ce5ba3ed28f309a674d7e7f77 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 10 Apr 2016 05:14:40 -0400 Subject: install mode: account for a directory DEST argument. --- src/logic/slbt_exec_install.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3