/* XXX: copy between two remote sites */
#include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.9 2001/02/10 00:41:46 djm Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.10 2001/02/14 09:46:03 djm Exp $");
#include "ssh.h"
#include "buffer.h"
return(errno);
}
- /* Override umask and utimes if asked */
- if (pflag && fchmod(local_fd, mode) == -1)
- error("Couldn't set mode on \"%s\": %s", local_path,
- strerror(errno));
- if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
- struct timeval tv;
-
- tv.tv_sec = a->atime;
- tv.tv_usec = a->mtime;
- if (utimes(local_path, &tv) == -1)
- error("Can't set times on \"%s\": %s", local_path,
- strerror(errno));
- }
-
buffer_init(&msg);
/* Send open request */
}
status = do_close(fd_in, fd_out, handle, handle_len);
+ /* Override umask and utimes if asked */
+ if (pflag && fchmod(local_fd, mode) == -1)
+ error("Couldn't set mode on \"%s\": %s", local_path,
+ strerror(errno));
+ if (pflag && (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME)) {
+ struct timeval tv[2];
+ tv[0].tv_sec = a->atime;
+ tv[1].tv_sec = a->mtime;
+ tv[0].tv_usec = tv[1].tv_usec = 0;
+ if (utimes(local_path, tv) == -1)
+ error("Can't set times on \"%s\": %s", local_path,
+ strerror(errno));
+ }
+
done:
close(local_fd);
buffer_free(&msg);
return(-1);
}
- /* Override umask and utimes if asked */
- if (pflag)
- do_fsetstat(fd_in, fd_out, handle, handle_len, &a);
-
/* Read from local and write to remote */
offset = 0;
for(;;) {
goto done;
}
+ /* Override umask and utimes if asked */
+ if (pflag)
+ do_fsetstat(fd_in, fd_out, handle, handle_len, &a);
+
status = do_close(fd_in, fd_out, handle, handle_len);
done:
buffer_free(&msg);
return status;
}
-
-