Skip to content

Commit

Permalink
Make errnum-verification more flexible (libfuse#824)
Browse files Browse the repository at this point in the history
Instead of hardcoding the value to check against, use a more dynamic method to verify the error number before passing it to the kernel.
  • Loading branch information
ikbenlike authored Aug 5, 2023
1 parent 98eb808 commit 7b9e7ee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/fuse_lowlevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7b9e7ee

Please sign in to comment.