aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorikbenlike <ikbenlike@users.noreply.github.com>2023-08-05 22:39:09 +0200
committerGitHub <noreply@github.com>2023-08-05 21:39:09 +0100
commit7b9e7eeec6c43a62ab1e02dfb6542e6bfb7f72dc (patch)
tree9e7e6608fa04f500281704d0b0f1660a574c2906
parent98eb80890446c18bee0e9c5fefc5947086672ee0 (diff)
downloadlibfuse-7b9e7eeec6c43a62ab1e02dfb6542e6bfb7f72dc.tar.gz
Make errnum-verification more flexible (#824)
Instead of hardcoding the value to check against, use a more dynamic method to verify the error number before passing it to the kernel.
-rw-r--r--lib/fuse_lowlevel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 4b9ee89..fdef193 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -213,7 +213,12 @@ int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
{
struct fuse_out_header out;
+#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 32
+ const char *str = strerrordesc_np(error * -1);
+ if ((str == NULL && error != 0) || error > 0) {
+#else
if (error <= -1000 || error > 0) {
+#endif
fuse_log(FUSE_LOG_ERR, "fuse: bad error value: %i\n", error);
error = -ERANGE;
}