X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/7bb18feb92815eec1c54b882ce5ab64c72c9580d..4bb8d5e02088fcd2ab911ded198ed65cdd3a97a8:/unix/uxsftp.c diff --git a/unix/uxsftp.c b/unix/uxsftp.c index fd6b528b..651047e9 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -18,6 +18,7 @@ #endif #include "putty.h" +#include "ssh.h" #include "psftp.h" #include "int64.h" @@ -33,11 +34,11 @@ char *x_get_default(const char *key) return NULL; /* this is a stub */ } -void platform_get_x11_auth(char *display, int *protocol, - unsigned char *data, int *datalen) +void platform_get_x11_auth(struct X11Display *display, Conf *conf) { /* Do nothing, therefore no auth. */ } +const int platform_uses_x11_unix_by_default = TRUE; /* * Default settings that are specific to PSFTP. @@ -124,7 +125,8 @@ struct RFile { }; RFile *open_existing_file(char *name, uint64 *size, - unsigned long *mtime, unsigned long *atime) + unsigned long *mtime, unsigned long *atime, + long *perms) { int fd; RFile *ret; @@ -136,7 +138,7 @@ RFile *open_existing_file(char *name, uint64 *size, ret = snew(RFile); ret->fd = fd; - if (size || mtime || atime) { + if (size || mtime || atime || perms) { struct stat statbuf; if (fstat(fd, &statbuf) < 0) { fprintf(stderr, "%s: stat: %s\n", name, strerror(errno)); @@ -152,6 +154,9 @@ RFile *open_existing_file(char *name, uint64 *size, if (atime) *atime = statbuf.st_atime; + + if (perms) + *perms = statbuf.st_mode; } return ret; @@ -173,12 +178,13 @@ struct WFile { char *name; }; -WFile *open_new_file(char *name) +WFile *open_new_file(char *name, long perms) { int fd; WFile *ret; - fd = open(name, O_CREAT | O_TRUNC | O_WRONLY, 0666); + fd = open(name, O_CREAT | O_TRUNC | O_WRONLY, + (mode_t)(perms ? perms : 0666)); if (fd < 0) return NULL; @@ -201,6 +207,7 @@ WFile *open_existing_wfile(char *name, uint64 *size) ret = snew(WFile); ret->fd = fd; + ret->name = dupstr(name); if (size) { struct stat statbuf;