Skip to content

Commit 373ff17

Browse files
authored
Merge pull request #29 from drougge/pathfixes
Fix surrogateescape handling in fsyncdir/readdir/write
2 parents ec3b879 + 33f439d commit 373ff17

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

fuseparts/_fusemodule.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,11 @@ releasedir_func(const char *path, struct fuse_file_info *fi)
410410
static int
411411
fsyncdir_func(const char *path, int datasync, struct fuse_file_info *fi)
412412
{
413+
#ifdef FIX_PATH_DECODING
414+
PROLOGUE( PYO_CALLWITHFI(fi, fsyncdir_cb, &Oi, &Path_AsDecodedUnicode, path, datasync) )
415+
#else
413416
PROLOGUE( PYO_CALLWITHFI(fi, fsyncdir_cb, si, path, datasync) )
417+
#endif
414418
EPILOGUE
415419
}
416420

@@ -462,7 +466,11 @@ readdir_func(const char *path, void *buf, fuse_fill_dir_t df, off_t off,
462466
{
463467
PyObject *iter, *w;
464468

469+
#ifdef FIX_PATH_DECODING
470+
PROLOGUE( PYO_CALLWITHFI(fi, readdir_cb, O&K, &Path_AsDecodedUnicode, path, off) )
471+
#else
465472
PROLOGUE( PYO_CALLWITHFI(fi, readdir_cb, sK, path, off) )
473+
#endif
466474
#else
467475
static int
468476
readdir_func(const char *path, fuse_dirh_t buf, fuse_dirfil_t df)
@@ -683,7 +691,11 @@ write_func(const char *path, const char *buf, size_t t, off_t off)
683691
#endif
684692
{
685693
#if PY_MAJOR_VERSION >= 3
694+
#ifdef FIX_PATH_DECODING
695+
PROLOGUE( PYO_CALLWITHFI(fi, write_cb, O&y#K, &Path_AsDecodedUnicode, path, buf, t, off) )
696+
#else
686697
PROLOGUE( PYO_CALLWITHFI(fi, write_cb, sy#K, path, buf, t, off) )
698+
#endif
687699
#else
688700
PROLOGUE( PYO_CALLWITHFI(fi, write_cb, ss#K, path, buf, t, off) )
689701
#endif

0 commit comments

Comments
 (0)