summaryrefslogtreecommitdiff
path: root/crypto/openssh/sftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/sftp.c')
-rw-r--r--crypto/openssh/sftp.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/crypto/openssh/sftp.c b/crypto/openssh/sftp.c
index 08e13a7336a6..2b8fdabfb6df 100644
--- a/crypto/openssh/sftp.c
+++ b/crypto/openssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.175 2016/07/22 03:47:36 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.177 2016/10/18 12:41:22 millert Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -17,7 +17,6 @@
#include "includes.h"
-#include <sys/param.h> /* MIN MAX */
#include <sys/types.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_STAT_H
@@ -233,6 +232,18 @@ killchild(int signo)
/* ARGSUSED */
static void
+suspchild(int signo)
+{
+ if (sshpid > 1) {
+ kill(sshpid, signo);
+ while (waitpid(sshpid, NULL, WUNTRACED) == -1 && errno == EINTR)
+ continue;
+ }
+ kill(getpid(), SIGSTOP);
+}
+
+/* ARGSUSED */
+static void
cmd_interrupt(int signo)
{
const char msg[] = "\rInterrupt \n";
@@ -802,7 +813,7 @@ do_ls_dir(struct sftp_conn *conn, const char *path,
/* Count entries for sort and find longest filename */
for (n = 0; d[n] != NULL; n++) {
if (d[n]->filename[0] != '.' || (lflag & LS_SHOW_ALL))
- m = MAX(m, strlen(d[n]->filename));
+ m = MAXIMUM(m, strlen(d[n]->filename));
}
/* Add any subpath that also needs to be counted */
@@ -814,9 +825,9 @@ do_ls_dir(struct sftp_conn *conn, const char *path,
width = ws.ws_col;
columns = width / (m + 2);
- columns = MAX(columns, 1);
+ columns = MAXIMUM(columns, 1);
colspace = width / columns;
- colspace = MIN(colspace, width);
+ colspace = MINIMUM(colspace, width);
}
if (lflag & SORT_FLAGS) {
@@ -915,10 +926,10 @@ do_globbed_ls(struct sftp_conn *conn, const char *path,
if (!(lflag & LS_SHORT_VIEW)) {
/* Count entries for sort and find longest filename */
for (i = 0; g.gl_pathv[i]; i++)
- m = MAX(m, strlen(g.gl_pathv[i]));
+ m = MAXIMUM(m, strlen(g.gl_pathv[i]));
columns = width / (m + 2);
- columns = MAX(columns, 1);
+ columns = MAXIMUM(columns, 1);
colspace = width / columns;
}
@@ -1669,16 +1680,16 @@ complete_display(char **list, u_int len)
/* Count entries for sort and find longest */
for (y = 0; list[y]; y++)
- m = MAX(m, strlen(list[y]));
+ m = MAXIMUM(m, strlen(list[y]));
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) != -1)
width = ws.ws_col;
m = m > len ? m - len : 0;
columns = width / (m + 2);
- columns = MAX(columns, 1);
+ columns = MAXIMUM(columns, 1);
colspace = width / columns;
- colspace = MIN(colspace, width);
+ colspace = MINIMUM(colspace, width);
printf("\n");
m = 1;
@@ -2214,6 +2225,9 @@ connect_to_server(char *path, char **args, int *in, int *out)
signal(SIGTERM, killchild);
signal(SIGINT, killchild);
signal(SIGHUP, killchild);
+ signal(SIGTSTP, suspchild);
+ signal(SIGTTIN, suspchild);
+ signal(SIGTTOU, suspchild);
close(c_in);
close(c_out);
}
@@ -2258,7 +2272,7 @@ main(int argc, char **argv)
ssh_malloc_init(); /* must be called before any mallocs */
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
sanitise_stdfd();
- setlocale(LC_CTYPE, "");
+ msetlocale();
__progname = ssh_get_progname(argv[0]);
memset(&args, '\0', sizeof(args));