Given that ERRNO_IS_PRIVILEGE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.
In this case the argument passed to ERRNO_IS_PRIVILEGE() is the value
returned by access_fd() which is not expected to return any positive
values, but let's be consistent anyway and move the ERRNO_IS_PRIVILEGE()
invocation to the branch where the return value is known to be negative.
r = -errno;
} else
r = access_fd(fd, R_OK);
- if (ERRNO_IS_PRIVILEGE(r)) {
- *ret_state = "inaccessible";
- *ret_color = ansi_highlight_yellow();
- *ret_size = UINT64_MAX;
- return;
- }
- if (r < 0)
+ if (r < 0) {
+ if (ERRNO_IS_PRIVILEGE(r)) {
+ *ret_state = "inaccessible";
+ *ret_color = ansi_highlight_yellow();
+ *ret_size = UINT64_MAX;
+ return;
+ }
goto error;
+ }
if (fstat(fd, &st) < 0)
goto error;