[PATCH] safe_gethostname

Tito farmatito at tiscali.it
Sun Feb 24 23:46:45 UTC 2008


Hi,
this is a preliminary patch that adds the new libbb function
safe_gethostname  and converts all
occurrences of gethostname to it.
The files changed by this patch are:

busybox/libbb/lineedit.c
busybox/libbb/login.c
busybox/libbb/obscure.c
busybox/miscutils/devfsd.c
busybox/networking/hostname.c
busybox/sysklogd/syslogd.c
busybox/include/libbb.h
busybox/libbb/safe_gethostname.c
busybox/libbb/Kbuild

I have some bloat-o-meter data, but they look
a little confusing as some stuff that is not touched by this
patch is sucked in:

scripts/bloat-o-meter busybox_old busybox_unstripped
function                                             old     new   delta
safe_gethostname                                       -      95     +95
pack_gzip                                           1646    1653      +7
syslogd_main                                         918     924      +6
fbset_main                                          2046    2052      +6
xstrtoull_range_sfx                                  294     296      +2
changepath                                           185     183      -2
xsocket_type                                         129     124      -5
do_time                                              490     485      -5
mainSort                                            2559    2553      -6
catv_main                                            340     328     -12
.rodata                                           121107  121095     -12
print_login_prompt                                   101      58     -43
print_login_issue                                    526     481     -45
obscure                                              435     376     -59
get_variable                                         302     236     -66
parse_and_put_prompt                                 825     756     -69
hostname_main                                        307     223     -84
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/12 up/down: 116/-408)        Total: -292 bytes

the relevant values should be:

scripts/bloat-o-meter busybox_old busybox_unstripped
function                                             old     new   delta
safe_gethostname                                       -      95     +95
syslogd_main                                         918     924      +6
.rodata                                           121107  121095     -12
print_login_prompt                                   101      58     -43
print_login_issue                                    526     481     -45
obscure                                              435     376     -59
get_variable                                         302     236     -66
parse_and_put_prompt                                 825     756     -69
hostname_main                                        307     223     -84
------------------------------------------------------------------------------
                                                                                             Total: -279 bytes


This stuff is not well tested and requires to be audited
by the list members.

Ciao,
Tito

-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe_gethostname02.patch
Type: text/x-diff
Size: 7307 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080225/3d872381/attachment-0002.bin 


More information about the busybox mailing list