summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sftp.c b/sftp.c
index 3c7bc64e1..9ab4e9f16 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.138 2012/09/18 10:36:12 dtucker Exp $ */ 1/* $OpenBSD: sftp.c,v 1.139 2012/09/21 10:53:07 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1699,7 +1699,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1699{ 1699{
1700 glob_t g; 1700 glob_t g;
1701 char *tmp, *tmp2, ins[3]; 1701 char *tmp, *tmp2, ins[3];
1702 u_int i, hadglob, pwdlen, len, tmplen, filelen; 1702 u_int i, hadglob, pwdlen, len, tmplen, filelen, isabs;
1703 const LineInfo *lf; 1703 const LineInfo *lf;
1704 1704
1705 /* Glob from "file" location */ 1705 /* Glob from "file" location */
@@ -1708,6 +1708,9 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1708 else 1708 else
1709 xasprintf(&tmp, "%s*", file); 1709 xasprintf(&tmp, "%s*", file);
1710 1710
1711 /* Check if the path is absolute. */
1712 isabs = tmp[0] == '/';
1713
1711 memset(&g, 0, sizeof(g)); 1714 memset(&g, 0, sizeof(g));
1712 if (remote != LOCAL) { 1715 if (remote != LOCAL) {
1713 tmp = make_absolute(tmp, remote_path); 1716 tmp = make_absolute(tmp, remote_path);
@@ -1742,7 +1745,7 @@ complete_match(EditLine *el, struct sftp_conn *conn, char *remote_path,
1742 goto out; 1745 goto out;
1743 1746
1744 tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc); 1747 tmp2 = complete_ambiguous(file, g.gl_pathv, g.gl_matchc);
1745 tmp = path_strip(tmp2, remote_path); 1748 tmp = path_strip(tmp2, isabs ? NULL : remote_path);
1746 xfree(tmp2); 1749 xfree(tmp2);
1747 1750
1748 if (tmp == NULL) 1751 if (tmp == NULL)