mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2024-12-02 16:56:32 +00:00
libbb: code shrink
function old new delta xmalloc_ttyname 46 42 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
aadb485bd0
commit
543efd7b4b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user