diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-06 00:54:06 +0200 |
|---|---|---|
| committer | Austin Foxley <austinf@cetoncorp.com> | 2009-09-18 11:38:16 -0700 |
| commit | ca0c6255774e0c1212dec5f698e54760c3936a6a (patch) | |
| tree | 01d38afa38f7ab9688c5f815b61e62a01282ff32 /libc | |
| parent | 99436fc7dccdcd3bd2cdf3730d8fc4f8dd6413f5 (diff) | |
| download | uClibc-alpine-ca0c6255774e0c1212dec5f698e54760c3936a6a.tar.bz2 uClibc-alpine-ca0c6255774e0c1212dec5f698e54760c3936a6a.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>
Signed-off-by: Austin Foxley <austinf@cetoncorp.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; |
