diff -r f66afda58cc9 lib/libc/net/rcmd.c --- a/lib/libc/net/rcmd.c Sat Jan 04 09:12:21 2014 +0200 +++ b/lib/libc/net/rcmd.c Mon Jan 06 13:15:01 2014 +0200 @@ -447,6 +447,7 @@ FILE *hostf; uid_t uid; int first; + int hostlstat; char pbuf[MAXPATHLEN]; const struct sockaddr *raddr; struct sockaddr_storage ss; @@ -482,6 +483,7 @@ uid = geteuid(); (void)seteuid(pwd->pw_uid); hostf = fopen(pbuf, "r"); + hostlstat = lstat(pbuf, &sbuf); (void)seteuid(uid); if (hostf == NULL) @@ -491,7 +493,7 @@ * user or root or if writeable by anyone but the owner, quit. */ cp = NULL; - if (lstat(pbuf, &sbuf) < 0) + if (hostlstat < 0) cp = ".rhosts lstat failed"; else if (!S_ISREG(sbuf.st_mode)) cp = ".rhosts not regular file";