summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/scp.c
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2001-04-14 17:04:43 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2001-04-14 17:04:43 +0000
commit9a7a8889ff5ab54b0caaa3cd0565968050615543 (patch)
tree93966148fe2273f8cc144b887863ceb3d34f4606 /usr.bin/ssh/scp.c
parentf38e8ebb4d051ef9b25d767d54567fdc712a6a67 (diff)
'T' handling rcp/scp sync; ok markus@
Diffstat (limited to 'usr.bin/ssh/scp.c')
-rw-r--r--usr.bin/ssh/scp.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index a19a19d6b46..b65f588f29c 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -75,7 +75,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.65 2001/04/06 16:46:59 deraadt Exp $");
+RCSID("$OpenBSD: scp.c,v 1.66 2001/04/14 17:04:42 stevesk Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -649,9 +649,10 @@ sink(argc, argv)
off_t size;
int setimes, targisdir, wrerrno = 0;
char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
- int dummy_usec;
struct timeval tv[2];
+#define atime tv[0]
+#define mtime tv[1]
#define SCREWUP(str) { why = str; goto screwup; }
setimes = targisdir = 0;
@@ -698,25 +699,21 @@ sink(argc, argv)
if (ch == '\n')
*--cp = 0;
-#define getnum(t) (t) = 0; \
- while (*cp >= '0' && *cp <= '9') (t) = (t) * 10 + (*cp++ - '0');
cp = buf;
if (*cp == 'T') {
setimes++;
cp++;
- getnum(tv[1].tv_sec);
- if (*cp++ != ' ')
+ mtime.tv_sec = strtol(cp, &cp, 10);
+ if (!cp || *cp++ != ' ')
SCREWUP("mtime.sec not delimited");
- getnum(dummy_usec);
- tv[1].tv_usec = 0;
- if (*cp++ != ' ')
+ mtime.tv_usec = strtol(cp, &cp, 10);
+ if (!cp || *cp++ != ' ')
SCREWUP("mtime.usec not delimited");
- getnum(tv[0].tv_sec);
- if (*cp++ != ' ')
+ atime.tv_sec = strtol(cp, &cp, 10);
+ if (!cp || *cp++ != ' ')
SCREWUP("atime.sec not delimited");
- getnum(dummy_usec);
- tv[0].tv_usec = 0;
- if (*cp++ != '\0')
+ atime.tv_usec = strtol(cp, &cp, 10);
+ if (!cp || *cp++ != '\0')
SCREWUP("atime.usec not delimited");
(void) atomicio(write, remout, "", 1);
continue;