* src/chown-core.c (restricted_chown): Don’t assume fchown exists.
The Gnulib doc says that nowadays this is needed only for
ports to mingw and MSVC 14, but it’s an easy port so let’s do it.
else if ((required_uid == (uid_t) -1 || required_uid == st.st_uid)
&& (required_gid == (gid_t) -1 || required_gid == st.st_gid))
{
+#if HAVE_FCHOWN
if (fchown (fd, uid, gid) == 0)
- {
- status = (close (fd) == 0
- ? RC_ok : RC_error);
- return status;
- }
- else
- {
- status = RC_error;
- }
+ return close (fd) < 0 ? RC_error : RC_ok;
+#endif
+ status = RC_error;
}
int saved_errno = errno;