mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(fchmod_new): Don't try to close fd if it's < 0.
This commit is contained in:
1 parent
07d7677196
commit
7be64dd68f
1 file changed
+1
-1
+1
-1
@@ -91,7 +91,7 @@ fchmod_new (char const *file, mode_t mode, dev_t device, mode_t file_type)
|
||||
saved_errno = errno;
|
||||
}
|
||||
|
||||
if (close (fd) != 0 && saved_errno == 0)
|
||||
if (0 <= fd && close (fd) != 0 && saved_errno == 0)
|
||||
saved_errno = errno;
|
||||
|
||||
errno = saved_errno;
|
||||
|
||||
Reference in new issue
Block a user