scp.c proposed changed.

Ben Lindstrom mouring at pconline.com
Tue Sep 5 16:50:26 EST 2000


I'm unsure at this point if I should split this patch in two and submit
part of it to the keeper of the OpenBSD's OpenSSH tree (Which is...=).  

The following patch changes utime() to utimes() in scp.  And also lets us
support usec.

The second half is to keep the NeXT port inline with this change. =)

--- scp.c.orig	Tue Aug 29 18:11:30 2000
+++ scp.c	Mon Sep  4 23:47:40 2000
@@ -683,8 +683,7 @@
 	off_t size;
 	int setimes, targisdir, wrerrno = 0;
 	char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
-	struct utimbuf ut;
-	int dummy_usec;
+	struct timeval tv[2];
 
 #define	SCREWUP(str)	{ why = str; goto screwup; }
 
@@ -738,16 +737,16 @@
 		if (*cp == 'T') {
 			setimes++;
 			cp++;
-			getnum(ut.modtime);
+			getnum(tv[1].tv_sec);
 			if (*cp++ != ' ')
 				SCREWUP("mtime.sec not delimited");
-			getnum(dummy_usec);
+			getnum(tv[1].tv_usec);
 			if (*cp++ != ' ')
 				SCREWUP("mtime.usec not delimited");
-			getnum(ut.actime);
+			getnum(tv[0].tv_sec);
 			if (*cp++ != ' ')
 				SCREWUP("atime.sec not delimited");
-			getnum(dummy_usec);
+			getnum(tv[0].tv_usec);
 			if (*cp++ != '\0')
 				SCREWUP("atime.usec not delimited");
 			(void) atomicio(write, remout, "", 1);
@@ -815,7 +814,7 @@
 			sink(1, vect);
 			if (setimes) {
 				setimes = 0;
-				if (utime(np, &ut) < 0)
+				if (utimes(np, tv) < 0)
 					run_err("%s: set times: %s",
 						np, strerror(errno));
 			}
@@ -902,7 +901,7 @@
 		(void) response();
 		if (setimes && wrerr == NO) {
 			setimes = 0;
-			if (utime(np, &ut) < 0) {
+			if (utimes(np, tv) < 0) {
 				run_err("%s: set times: %s",
 					np, strerror(errno));
 				wrerr = DISPLAYED;
--- next-posix.c.orig	Thu Aug 31 22:14:37 2000
+++ next-posix.c	Mon Sep  4 23:47:50 2000
@@ -18,20 +18,6 @@
 	return wait_pid;
 }
 
-
-int                                          
-posix_utime(char *filename,struct utimbuf *buf)
-{                                            
-        time_t timep[2];                     
-                                             
-        timep[0] = buf->actime;              
-        timep[1] = buf->modtime;             
-
-        #undef utime			/* Use NeXT's utime() function */ 
-        return utime(filename,timep);        
-}                                            
-
-
 int
 waitpid(int	pid, int	*stat_loc, int	options)
 {
--- next-posix.h.orig	Tue Aug 29 18:11:30 2000
+++ next-posix.h	Mon Sep  4 23:47:50 2000
@@ -36,9 +36,6 @@
 #define WCOREDUMP(w) 	((w) & WCOREFLAG)
 
 /* POSIX "wrapper" functions to replace to BSD functions */
-int posix_utime(char *filename, struct utimbuf *buf);	/* new utime() */
-#define utime posix_utime
-
 pid_t posix_wait(int *status);				/* new wait() */
 #define wait posix_wait	
 






More information about the openssh-unix-dev mailing list