Skip to content

Commit fb17470

Browse files
joshtriplettNikratio
authored andcommitted
Add workaround to always pass a 0 mode when creating a file (#128)
Add workaround to always pass a 0 mode when creating a file This works around servers that produce an error for any non-zero mode.
1 parent 39663c8 commit fb17470

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

ChangeLog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Unreleased Changes
2+
------------------
3+
4+
* New `createmode` workaround.
5+
16
Release 3.3.2 (2018-04-29)
27
--------------------------
38

sshfs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct sshfs {
219219
int buflimit_workaround;
220220
int unrel_append;
221221
int fstat_workaround;
222+
int createmode_workaround;
222223
int transform_symlinks;
223224
int follow_symlinks;
224225
int no_check_root;
@@ -455,6 +456,8 @@ static struct fuse_opt workaround_opts[] = {
455456
SSHFS_OPT("nobuflimit", buflimit_workaround, 0),
456457
SSHFS_OPT("fstat", fstat_workaround, 1),
457458
SSHFS_OPT("nofstat", fstat_workaround, 0),
459+
SSHFS_OPT("createmode", createmode_workaround, 1),
460+
SSHFS_OPT("nocreatemode", createmode_workaround, 0),
458461
FUSE_OPT_END
459462
};
460463

@@ -3100,6 +3103,9 @@ static int sshfs_statfs(const char *path, struct statvfs *buf)
31003103
static int sshfs_create(const char *path, mode_t mode,
31013104
struct fuse_file_info *fi)
31023105
{
3106+
if (sshfs.createmode_workaround)
3107+
mode = 0;
3108+
31033109
return sshfs_open_common(path, mode, fi);
31043110
}
31053111

@@ -3374,6 +3380,7 @@ static void usage(const char *progname)
33743380
" [no]truncate fix truncate for old servers (default: off)\n"
33753381
" [no]buflimit fix buffer fillup bug in server (default: on)\n"
33763382
" [no]fstat always use stat() instead of fstat() (default: off)\n"
3383+
" [no]createmode always pass mode 0 to create (default: off)\n"
33773384
" -o idmap=TYPE user/group ID mapping (default: " IDMAP_DEFAULT ")\n"
33783385
" none no translation of the ID space\n"
33793386
" user only translate UID/GID of connecting user\n"
@@ -3860,6 +3867,7 @@ int main(int argc, char *argv[])
38603867
sshfs.renamexdev_workaround = 0;
38613868
sshfs.truncate_workaround = 0;
38623869
sshfs.buflimit_workaround = 1;
3870+
sshfs.createmode_workaround = 0;
38633871
sshfs.ssh_ver = 2;
38643872
sshfs.progname = argv[0];
38653873
sshfs.rfd = -1;

sshfs.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Options
115115
:fstat: Work around broken servers that don't support *fstat()* by
116116
using *stat* instead.
117117
:buflimit: Work around OpenSSH "buffer fillup" bug.
118+
:createmode: Work around broken servers that produce an error when passing a
119+
non-zero mode to create, by always passing a mode of 0.
118120

119121
-o idmap=TYPE
120122
How to map remote UID/GIDs to local values. Possible values are:

0 commit comments

Comments
 (0)