diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-05-07 22:40:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-05-07 22:40:26 +0000 |
commit | 6ac52e83bd426918e49b05fd6c19245e0111ebd9 (patch) | |
tree | 4066e1210690fa126ab8607429ac022a7dbc91bf | |
parent | 74a0513daf4ea71825ffe545982724cfa3741b24 (diff) | |
download | glibc-6ac52e83bd426918e49b05fd6c19245e0111ebd9.tar.gz glibc-6ac52e83bd426918e49b05fd6c19245e0111ebd9.tar.xz glibc-6ac52e83bd426918e49b05fd6c19245e0111ebd9.zip |
Update.
* inet/rcmd.c (rcmd_af): errno is not set if read returns without reading anything. Reported by Andries.Brouwer@cwi.nl.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | inet/rcmd.c | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 4eb2e17d58..c3fc5a9a3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-05-07 Ulrich Drepper <drepper@redhat.com> + * inet/rcmd.c (rcmd_af): errno is not set if read returns without + reading anything. Reported by Andries.Brouwer@cwi.nl. + * sysdeps/generic/memccpy.c (__memccpy): Don't use reg_char type for x since promotion in comparison might leads to unexpected results. Reported by Dan Pop <Dan.Pop@cern.ch>. 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) { |