aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-08-06 00:41:06 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-08-06 00:41:06 +0200
commit543efd7b4b4265ae507b4e3b048bf23a51a726fc (patch)
treeabd856fe3c73b8724f602d4b5e1f87bc1eb6e2c1
parentaadb485bd01ce22f04d22383efbe4f5f82bbab3c (diff)
downloadbusybox-w32-543efd7b4b4265ae507b4e3b048bf23a51a726fc.tar.gz
busybox-w32-543efd7b4b4265ae507b4e3b048bf23a51a726fc.tar.bz2
busybox-w32-543efd7b4b4265ae507b4e3b048bf23a51a726fc.zip
libbb: code shrink
function old new delta xmalloc_ttyname 46 42 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/xfuncs_printf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 05aa07ce8..a70683241 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -541,13 +541,11 @@ int FAST_FUNC bb_xioctl(int fd, unsigned request, void *argp)
541 541
542char* FAST_FUNC xmalloc_ttyname(int fd) 542char* FAST_FUNC xmalloc_ttyname(int fd)
543{ 543{
544 char *buf = xzalloc(128); 544 char buf[128];
545 int r = ttyname_r(fd, buf, 127); 545 int r = ttyname_r(fd, buf, sizeof(buf) - 1);
546 if (r) { 546 if (r)
547 free(buf); 547 return NULL;
548 buf = NULL; 548 return xstrdup(buf);
549 }
550 return buf;
551} 549}
552 550
553void FAST_FUNC generate_uuid(uint8_t *buf) 551void FAST_FUNC generate_uuid(uint8_t *buf)