aboutsummaryrefslogtreecommitdiff
path: root/inet
diff options
context:
space:
mode:
Diffstat (limited to 'inet')
-rw-r--r--inet/rcmd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c
index f3dc1bd4ab..dd0fd35123 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -117,6 +117,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
char c;
int refused;
char num[8];
+ ssize_t n;
if (af != AF_INET && af != AF_INET6)
{
@@ -265,9 +266,13 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
(void)__write(s, locuser, strlen(locuser)+1);
(void)__write(s, remuser, strlen(remuser)+1);
(void)__write(s, cmd, strlen(cmd)+1);
- if (__read(s, &c, 1) != 1) {
- (void)fprintf(stderr,
- "rcmd: %s: %m\n", *ahost);
+ n = __read(s, &c, 1);
+ if (n != 1) {
+ if (n == 0)
+ (void)fprintf(stderr, _("rcmd: %s: short read"),
+ *ahost);
+ else
+ (void)fprintf(stderr, "rcmd: %s: %m\n", *ahost);
goto bad2;
}
if (c != 0) {