[git commit nptl] rexec.c: small code shrink
Denys Vlasenko
vda.linux at googlemail.com
Fri Sep 18 14:07:31 UTC 2009
commit: http://git.uclibc.org/uClibc/commit/?id=ca0c6255774e0c1212dec5f698e54760c3936a6a
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/nptl
text data bss dec hex filename
- 1223 0 0 1223 4c7 libc/inet/rpc/rexec.o
+ 1214 0 0 2239 8bf libc/inet/rpc/rexec.o
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
libc/inet/rpc/rexec.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libc/inet/rpc/rexec.c b/libc/inet/rpc/rexec.c
index 8305b4a..11c4b9f 100644
--- a/libc/inet/rpc/rexec.c
+++ b/libc/inet/rpc/rexec.c
@@ -83,8 +83,12 @@ rexec_af(char **ahost, int rport, const char *name, const char *pass, const char
int gai;
char servbuff[NI_MAXSERV];
- snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
- servbuff[sizeof(servbuff) - 1] = '\0';
+ if (sizeof(servbuff) < sizeof(int)*3 + 2) {
+ snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
+ servbuff[sizeof(servbuff) - 1] = '\0';
+ } else {
+ sprintf(servbuff, "%d", ntohs(rport));
+ }
memset(&hints, '\0', sizeof(hints));
hints.ai_family = af;
--
1.6.3.3
More information about the uClibc-cvs
mailing list