summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/scp.c b/scp.c
index 79c310c5e..72949d0ec 100644
--- a/scp.c
+++ b/scp.c
@@ -75,11 +75,10 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.39 2000/09/07 20:53:00 markus Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.40 2000/09/21 11:11:42 markus Exp $");
79 79
80#include "ssh.h" 80#include "ssh.h"
81#include "xmalloc.h" 81#include "xmalloc.h"
82#include <utime.h>
83 82
84#define _PATH_CP "cp" 83#define _PATH_CP "cp"
85 84
@@ -711,8 +710,8 @@ sink(argc, argv)
711 off_t size; 710 off_t size;
712 int setimes, targisdir, wrerrno = 0; 711 int setimes, targisdir, wrerrno = 0;
713 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; 712 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
714 struct utimbuf ut;
715 int dummy_usec; 713 int dummy_usec;
714 struct timeval tv[2];
716 715
717#define SCREWUP(str) { why = str; goto screwup; } 716#define SCREWUP(str) { why = str; goto screwup; }
718 717
@@ -766,16 +765,18 @@ sink(argc, argv)
766 if (*cp == 'T') { 765 if (*cp == 'T') {
767 setimes++; 766 setimes++;
768 cp++; 767 cp++;
769 getnum(ut.modtime); 768 getnum(tv[1].tv_sec);
770 if (*cp++ != ' ') 769 if (*cp++ != ' ')
771 SCREWUP("mtime.sec not delimited"); 770 SCREWUP("mtime.sec not delimited");
772 getnum(dummy_usec); 771 getnum(dummy_usec);
772 tv[1].tv_usec = 0;
773 if (*cp++ != ' ') 773 if (*cp++ != ' ')
774 SCREWUP("mtime.usec not delimited"); 774 SCREWUP("mtime.usec not delimited");
775 getnum(ut.actime); 775 getnum(tv[0].tv_sec);
776 if (*cp++ != ' ') 776 if (*cp++ != ' ')
777 SCREWUP("atime.sec not delimited"); 777 SCREWUP("atime.sec not delimited");
778 getnum(dummy_usec); 778 getnum(dummy_usec);
779 tv[0].tv_usec = 0;
779 if (*cp++ != '\0') 780 if (*cp++ != '\0')
780 SCREWUP("atime.usec not delimited"); 781 SCREWUP("atime.usec not delimited");
781 (void) atomicio(write, remout, "", 1); 782 (void) atomicio(write, remout, "", 1);
@@ -843,7 +844,7 @@ sink(argc, argv)
843 sink(1, vect); 844 sink(1, vect);
844 if (setimes) { 845 if (setimes) {
845 setimes = 0; 846 setimes = 0;
846 if (utime(np, &ut) < 0) 847 if (utimes(np, tv) < 0)
847 run_err("%s: set times: %s", 848 run_err("%s: set times: %s",
848 np, strerror(errno)); 849 np, strerror(errno));
849 } 850 }
@@ -930,7 +931,7 @@ bad: run_err("%s: %s", np, strerror(errno));
930 (void) response(); 931 (void) response();
931 if (setimes && wrerr == NO) { 932 if (setimes && wrerr == NO) {
932 setimes = 0; 933 setimes = 0;
933 if (utime(np, &ut) < 0) { 934 if (utimes(np, tv) < 0) {
934 run_err("%s: set times: %s", 935 run_err("%s: set times: %s",
935 np, strerror(errno)); 936 np, strerror(errno));
936 wrerr = DISPLAYED; 937 wrerr = DISPLAYED;