libbb: add strncpy_IFNAMSIZ
function old new delta ... udhcp_read_interface 225 220 -5 brctl_main 1151 1146 -5 add_interface 109 104 -5 ipaddr_list_or_flush 2174 2167 -7 do_add_ioctl 88 80 -8 vconfig_main 249 240 -9 do_del_ioctl 78 68 -10 do_iplink 1186 1173 -13 do_if_fetch 766 753 -13 buffer_fill_and_print 196 179 -17 parse_args 1709 1684 -25 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140) Total: -129 bytes
This commit is contained in:
@@ -40,6 +40,14 @@ int FAST_FUNC close_on_exec_on(int fd)
|
||||
return fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src)
|
||||
{
|
||||
#ifndef IFNAMSIZ
|
||||
enum { IFNAMSIZ = 16 };
|
||||
#endif
|
||||
return strncpy(dst, src, IFNAMSIZ);
|
||||
}
|
||||
|
||||
/* Convert unsigned long long value into compact 4-char
|
||||
* representation. Examples: "1234", "1.2k", " 27M", "123T"
|
||||
* String is not terminated (buf[4] is untouched) */
|
||||
|
Reference in New Issue
Block a user