diff options
author | Damien Miller <djm@mindrot.org> | 1999-11-25 11:54:57 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-11-25 11:54:57 +1100 |
commit | 5428f646ad32da88ddd04a8c287d595524674fbf (patch) | |
tree | cc1f1e5d7852e1f44d41077f776abf7dab7ac06d /scp.c | |
parent | 9072e1889648988da38b7b81bce95291c1dc3a23 (diff) |
- More reformatting merged from OpenBSD CVS
- Merged OpenBSD CVS changes:
- [channels.c]
report from mrwizard@psu.edu via djm@ibs.com.au
- [channels.c]
set SO_REUSEADDR and SO_LINGER for forwarded ports.
chip@valinux.com via damien@ibs.com.au
- [nchan.c]
it's not an error() if shutdown_write failes in nchan.
- [readconf.c]
remove dead #ifdef-0-code
- [readconf.c servconf.c]
strcasecmp instead of tolower
- [scp.c]
progress meter overflow fix from damien@ibs.com.au
- [ssh-add.1 ssh-add.c]
SSH_ASKPASS support
- [ssh.1 ssh.c]
postpone fork_after_authentication until command execution,
request/patch from jahakala@cc.jyu.fi via damien@ibs.com.au
plus: use daemon() for backgrounding
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -45,7 +45,7 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include "includes.h" | 47 | #include "includes.h" |
48 | RCSID("$Id: scp.c,v 1.9 1999/11/24 13:26:22 damien Exp $"); | 48 | RCSID("$Id: scp.c,v 1.10 1999/11/25 00:54:59 damien Exp $"); |
49 | 49 | ||
50 | #include "ssh.h" | 50 | #include "ssh.h" |
51 | #include "xmalloc.h" | 51 | #include "xmalloc.h" |
@@ -97,9 +97,11 @@ char *identity = NULL; | |||
97 | /* This is the port to use in contacting the remote site (is non-NULL). */ | 97 | /* This is the port to use in contacting the remote site (is non-NULL). */ |
98 | char *port = NULL; | 98 | char *port = NULL; |
99 | 99 | ||
100 | /* This function executes the given command as the specified user on the given | 100 | /* |
101 | host. This returns < 0 if execution fails, and >= 0 otherwise. | 101 | * This function executes the given command as the specified user on the |
102 | This assigns the input and output file descriptors on success. */ | 102 | * given host. This returns < 0 if execution fails, and >= 0 otherwise. This |
103 | * assigns the input and output file descriptors on success. | ||
104 | */ | ||
103 | 105 | ||
104 | int | 106 | int |
105 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) | 107 | do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) |
@@ -110,8 +112,10 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout) | |||
110 | fprintf(stderr, "Executing: host %s, user %s, command %s\n", | 112 | fprintf(stderr, "Executing: host %s, user %s, command %s\n", |
111 | host, remuser ? remuser : "(unspecified)", cmd); | 113 | host, remuser ? remuser : "(unspecified)", cmd); |
112 | 114 | ||
113 | /* Reserve two descriptors so that the real pipes won't get | 115 | /* |
114 | descriptors 0 and 1 because that will screw up dup2 below. */ | 116 | * Reserve two descriptors so that the real pipes won't get |
117 | * descriptors 0 and 1 because that will screw up dup2 below. | ||
118 | */ | ||
115 | pipe(reserved); | 119 | pipe(reserved); |
116 | 120 | ||
117 | /* Create a socket pair for communicating with ssh. */ | 121 | /* Create a socket pair for communicating with ssh. */ |
@@ -970,7 +974,7 @@ run_err(const char *fmt,...) | |||
970 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 974 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
971 | * SUCH DAMAGE. | 975 | * SUCH DAMAGE. |
972 | * | 976 | * |
973 | * $Id: scp.c,v 1.9 1999/11/24 13:26:22 damien Exp $ | 977 | * $Id: scp.c,v 1.10 1999/11/25 00:54:59 damien Exp $ |
974 | */ | 978 | */ |
975 | 979 | ||
976 | char * | 980 | char * |
@@ -1142,7 +1146,7 @@ progressmeter(int flag) | |||
1142 | (void) gettimeofday(&now, (struct timezone *) 0); | 1146 | (void) gettimeofday(&now, (struct timezone *) 0); |
1143 | cursize = statbytes; | 1147 | cursize = statbytes; |
1144 | if (totalbytes != 0) { | 1148 | if (totalbytes != 0) { |
1145 | ratio = cursize * 100.0 / totalbytes; | 1149 | ratio = 100.0 * cursize / totalbytes; |
1146 | ratio = MAX(ratio, 0); | 1150 | ratio = MAX(ratio, 0); |
1147 | ratio = MIN(ratio, 100); | 1151 | ratio = MIN(ratio, 100); |
1148 | } else | 1152 | } else |