projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aadb485
)
libbb: code shrink
author
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 5 Aug 2013 22:41:06 +0000
(
00:41
+0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Mon, 5 Aug 2013 22:41:06 +0000
(
00:41
+0200)
function old new delta
xmalloc_ttyname 46 42 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/xfuncs_printf.c
patch
|
blob
|
history
diff --git
a/libbb/xfuncs_printf.c
b/libbb/xfuncs_printf.c
index 05aa07ce80151077676aa072073f81fffc3dd4f9..a7068324112e7571433a3a733502cc513c0f62c0 100644
(file)
--- 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)
char* FAST_FUNC xmalloc_ttyname(int fd)
{
- char *buf = xzalloc(128);
- int r = ttyname_r(fd, buf, 127);
- if (r) {
- free(buf);
- buf = NULL;
- }
- return buf;
+ char buf[128];
+ int r = ttyname_r(fd, buf, sizeof(buf) - 1);
+ if (r)
+ return NULL;
+ return xstrdup(buf);
}
void FAST_FUNC generate_uuid(uint8_t *buf)