fuse: Improve error handling.

Don't manipulate errno by hand as it's error prone and leads
to more complicated code. Moreover, it's far more brittle as it's
possible that the value gets accidentally overwritten by a c library
call deeper in the stack.

Only permitted uses of errno in this code are those that are provably
safe, i.e that the value is read immediately after a library call that
is documented to set errno. They usually look like this :

if (library_call() < 0) {  // Failure
    fuse_reply_err(req, errno);
    return;
}

Test: atest FuseDaemonHostTest

Change-Id: I2563feaf23dd82ae27e8306049be5b4f5234fd0f
1 file changed