X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/4a693cfc5c3ee0e639bbee0215345e921715ab04..962468d4b96c33869e9131eb42a0c784591f5884:/unix/uxsftp.c diff --git a/unix/uxsftp.c b/unix/uxsftp.c index 3170ecf3..61847d8e 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -53,21 +53,17 @@ int platform_default_i(const char *name, int def) return def; } -FontSpec platform_default_fontspec(const char *name) +FontSpec *platform_default_fontspec(const char *name) { - FontSpec ret; - *ret.name = '\0'; - return ret; + return fontspec_new(""); } -Filename platform_default_filename(const char *name) +Filename *platform_default_filename(const char *name) { - Filename ret; if (!strcmp(name, "LogFileName")) - strcpy(ret.path, "putty.log"); + return filename_from_str("putty.log"); else - *ret.path = '\0'; - return ret; + return filename_from_str(""); } char *get_ttymode(void *frontend, const char *mode) { return NULL; } @@ -125,7 +121,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; @@ -137,7 +134,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)); @@ -153,6 +150,9 @@ RFile *open_existing_file(char *name, uint64 *size, if (atime) *atime = statbuf.st_atime; + + if (perms) + *perms = statbuf.st_mode; } return ret; @@ -174,12 +174,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;