diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-06 00:54:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-06 00:54:06 +0200 |
commit | df5766bd4b7b020c54f683ebd24ab233defb74a9 (patch) | |
tree | 709a737f055869865fd46d167dc721e3ebcc979e /libc | |
parent | 29d28a3767b5a825ad34bb0adbcef719e3630186 (diff) | |
download | uClibc-alpine-df5766bd4b7b020c54f683ebd24ab233defb74a9.tar.bz2 uClibc-alpine-df5766bd4b7b020c54f683ebd24ab233defb74a9.tar.xz |
rexec.c: small code shrink
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@googlemail.com>
Diffstat (limited to 'libc')
-rw-r--r-- | 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 8305b4a20..11c4b9f83 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; |