diff options
author | Jim Meyering <jim@meyering.net> | 2005-12-20 10:24:37 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2005-12-20 10:24:37 +0000 |
commit | 7be64dd68fb5b5565cddc2a2b8f8b615f108ea80 (patch) | |
tree | bd3401f6c3f13e4573decb0acec8daf20588b173 /lib | |
parent | 07d76771965c4f19e803e133a921e0b9838074a8 (diff) | |
download | coreutils-7be64dd68fb5b5565cddc2a2b8f8b615f108ea80.tar.xz |
(fchmod_new): Don't try to close fd if it's < 0.
Diffstat (limited to 'lib')
-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; |