diff --git a/ChangeLog.rst b/ChangeLog.rst index ed48205..8afe917 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -7,6 +7,10 @@ UNRELEASED CHANGES * Added documentation for FUSE_CAP_FLOCK_LOCKS. +* fuse_loop(), fuse_loop_mt(), fuse_session_loop() and + fuse_session_loop_mt() now return -errno instead of -1 in case of + failure. + FUSE 3.0.0-rc2 (2016-11-06) =========================== diff --git a/include/fuse.h b/include/fuse.h index 682f731..e99f04d 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -828,7 +828,7 @@ void fuse_destroy(struct fuse *f); * operations are called. * * @param f the FUSE handle - * @return 0 if no error occurred, -1 otherwise + * @return 0 if no error occurred, -errno otherwise * * See also: fuse_loop() */ @@ -871,7 +871,7 @@ void fuse_exit(struct fuse *f); * @param f the FUSE handle * @param clone_fd whether to use separate device fds for each thread * (may increase performance) - * @return 0 if no error occurred, -1 otherwise + * @return 0 if no error occurred, -errno otherwise * * See also: fuse_loop() */ diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 8617f0e..dbf1a27 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1783,7 +1783,7 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint); * fuse_set_signal_handlers() first. * * @param se the session - * @return 0 on success, -1 on error + * @return 0 on success, -errno on failure */ int fuse_session_loop(struct fuse_session *se); @@ -1793,7 +1793,7 @@ int fuse_session_loop(struct fuse_session *se); * @param se the session * @param clone_fd whether to use separate device fds for each thread * (may increase performance) - * @return 0 on success, -1 on error + * @return 0 on success, -errno on failure */ int fuse_session_loop_mt(struct fuse_session *se, int clone_fd); diff --git a/lib/fuse_i.h b/lib/fuse_i.h index ec29c4e..1e99c6f 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -63,6 +63,7 @@ struct fuse_session { uint64_t notify_ctr; struct fuse_notify_req notify_list; size_t bufsize; + int error; }; struct fuse_chan { diff --git a/lib/fuse_loop.c b/lib/fuse_loop.c index 4a85b13..c847bd8 100644 --- a/lib/fuse_loop.c +++ b/lib/fuse_loop.c @@ -35,6 +35,8 @@ int fuse_session_loop(struct fuse_session *se) } free(fbuf.mem); + if(se->error != 0) + res = se->error; fuse_session_reset(se); - return res < 0 ? -1 : 0; + return res; } diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index 54fb56d..42d3e03 100644 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -339,6 +339,8 @@ int fuse_session_loop_mt(struct fuse_session *se, int clone_fd) pthread_mutex_destroy(&mt.lock); sem_destroy(&mt.finish); + if(se->error != 0) + err = se->error; fuse_session_reset(se); return err; } diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 8455669..4cc4193 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2940,6 +2940,7 @@ void fuse_session_exit(struct fuse_session *se) void fuse_session_reset(struct fuse_session *se) { se->exited = 0; + se->error = 0; } int fuse_session_exited(struct fuse_session *se)