diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -75,7 +75,7 @@ | |||
75 | */ | 75 | */ |
76 | 76 | ||
77 | #include "includes.h" | 77 | #include "includes.h" |
78 | RCSID("$OpenBSD: scp.c,v 1.65 2001/04/06 16:46:59 deraadt Exp $"); | 78 | RCSID("$OpenBSD: scp.c,v 1.66 2001/04/14 17:04:42 stevesk Exp $"); |
79 | 79 | ||
80 | #include "xmalloc.h" | 80 | #include "xmalloc.h" |
81 | #include "atomicio.h" | 81 | #include "atomicio.h" |
@@ -677,9 +677,10 @@ sink(argc, argv) | |||
677 | off_t size; | 677 | off_t size; |
678 | int setimes, targisdir, wrerrno = 0; | 678 | int setimes, targisdir, wrerrno = 0; |
679 | char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; | 679 | char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; |
680 | int dummy_usec; | ||
681 | struct timeval tv[2]; | 680 | struct timeval tv[2]; |
682 | 681 | ||
682 | #define atime tv[0] | ||
683 | #define mtime tv[1] | ||
683 | #define SCREWUP(str) { why = str; goto screwup; } | 684 | #define SCREWUP(str) { why = str; goto screwup; } |
684 | 685 | ||
685 | setimes = targisdir = 0; | 686 | setimes = targisdir = 0; |
@@ -726,25 +727,21 @@ sink(argc, argv) | |||
726 | if (ch == '\n') | 727 | if (ch == '\n') |
727 | *--cp = 0; | 728 | *--cp = 0; |
728 | 729 | ||
729 | #define getnum(t) (t) = 0; \ | ||
730 | while (*cp >= '0' && *cp <= '9') (t) = (t) * 10 + (*cp++ - '0'); | ||
731 | cp = buf; | 730 | cp = buf; |
732 | if (*cp == 'T') { | 731 | if (*cp == 'T') { |
733 | setimes++; | 732 | setimes++; |
734 | cp++; | 733 | cp++; |
735 | getnum(tv[1].tv_sec); | 734 | mtime.tv_sec = strtol(cp, &cp, 10); |
736 | if (*cp++ != ' ') | 735 | if (!cp || *cp++ != ' ') |
737 | SCREWUP("mtime.sec not delimited"); | 736 | SCREWUP("mtime.sec not delimited"); |
738 | getnum(dummy_usec); | 737 | mtime.tv_usec = strtol(cp, &cp, 10); |
739 | tv[1].tv_usec = 0; | 738 | if (!cp || *cp++ != ' ') |
740 | if (*cp++ != ' ') | ||
741 | SCREWUP("mtime.usec not delimited"); | 739 | SCREWUP("mtime.usec not delimited"); |
742 | getnum(tv[0].tv_sec); | 740 | atime.tv_sec = strtol(cp, &cp, 10); |
743 | if (*cp++ != ' ') | 741 | if (!cp || *cp++ != ' ') |
744 | SCREWUP("atime.sec not delimited"); | 742 | SCREWUP("atime.sec not delimited"); |
745 | getnum(dummy_usec); | 743 | atime.tv_usec = strtol(cp, &cp, 10); |
746 | tv[0].tv_usec = 0; | 744 | if (!cp || *cp++ != '\0') |
747 | if (*cp++ != '\0') | ||
748 | SCREWUP("atime.usec not delimited"); | 745 | SCREWUP("atime.usec not delimited"); |
749 | (void) atomicio(write, remout, "", 1); | 746 | (void) atomicio(write, remout, "", 1); |
750 | continue; | 747 | continue; |