summaryrefslogtreecommitdiff
path: root/lib/lchown.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-05-24 14:00:03 +0000
committerJim Meyering <jim@meyering.net>1998-05-24 14:00:03 +0000
commit2aacc55e9b00b39cdc0c6db02d9b944a37fc53ea (patch)
tree05281b03f0b8d3e7071f9664d35b34cde0d13a7c /lib/lchown.c
parent6f050de759a56337c3bf916eaab666762db0da53 (diff)
downloadcoreutils-2aacc55e9b00b39cdc0c6db02d9b944a37fc53ea.tar.xz
Fix braino: check S_ISLNK only if lstat succeeds.
Diffstat (limited to 'lib/lchown.c')
-rw-r--r--lib/lchown.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lchown.c b/lib/lchown.c
index 3e2b6c9f2..0b1ebd8f2 100644
--- a/lib/lchown.c
+++ b/lib/lchown.c
@@ -34,7 +34,7 @@ lchown (const char *file, uid_t uid, gid_t gid)
{
struct stat stats;
- if (lstat (file, &stats) && S_ISLNK (stats.st_mode))
+ if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
{
errno = ENOSYS;
return -1;