diff options
-rw-r--r-- | lib/chmod-safer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chmod-safer.c b/lib/chmod-safer.c index 995efdc36..218a11448 100644 --- a/lib/chmod-safer.c +++ b/lib/chmod-safer.c @@ -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; |