summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-10 05:14:40 -0400
committermidipix <writeonce@midipix.org>2016-04-10 05:14:40 -0400
commit061d4ac5055c2d5ce5ba3ed28f309a674d7e7f77 (patch)
tree157ed771b0fe11234c24e6de030e3c154f3ab711
parent73ca7898471c9aaf4552dac3935de343c4ef0ce5 (diff)
downloadslibtool-061d4ac5055c2d5ce5ba3ed28f309a674d7e7f77.tar.bz2
slibtool-061d4ac5055c2d5ce5ba3ed28f309a674d7e7f77.tar.xz
install mode: account for a directory DEST argument.
-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;