aboutsummaryrefslogtreecommitdiff
path: root/miscutils/devfsd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-09 18:16:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-09 18:16:40 +0200
commit02859aaeb29fb83167364291f1ce26b54c23803b (patch)
tree93a30e982b81e3bde6af8800bcd0c8f3f0080f52 /miscutils/devfsd.c
parente52da5570eb93d6cb2950e55c48bd22edb5a9f18 (diff)
downloadbusybox-w32-02859aaeb29fb83167364291f1ce26b54c23803b.tar.gz
busybox-w32-02859aaeb29fb83167364291f1ce26b54c23803b.tar.bz2
busybox-w32-02859aaeb29fb83167364291f1ce26b54c23803b.zip
use auto_string() where appropriate to kill a few statics
Custom linker script 'busybox_ldscript' found, using it function old new delta static.str 4 - -4 static.passwd 4 0 -4 bb_ask 322 311 -11 ether_print 63 47 -16 UNSPEC_print 82 66 -16 INET_sprint 59 38 -21 INET6_sprint 54 30 -24 make_human_readable_str 292 235 -57 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153) Total: -153 bytes text data bss dec hex filename 939880 992 17480 958352 e9f90 busybox_old 939736 992 17456 958184 e9ee8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/devfsd.c')
-rw-r--r--miscutils/devfsd.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 5a6aec6bd..9256567cc 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -1142,19 +1142,19 @@ static void signal_handler(int sig)
1142 1142
1143static const char *get_variable(const char *variable, void *info) 1143static const char *get_variable(const char *variable, void *info)
1144{ 1144{
1145 static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */
1146 static char *hostname; 1145 static char *hostname;
1147 1146
1148 struct get_variable_info *gv_info = info; 1147 struct get_variable_info *gv_info = info;
1149 const char *field_names[] = { 1148 const char *field_names[] = {
1150 "hostname", "mntpt", "devpath", "devname", 1149 "hostname", "mntpt", "devpath", "devname", "uid", "gid", "mode",
1151 "uid", "gid", "mode", hostname, mount_point, 1150 NULL, mount_point, gv_info->devpath, gv_info->devname, NULL
1152 gv_info->devpath, gv_info->devname, NULL
1153 }; 1151 };
1154 int i; 1152 int i;
1155 1153
1156 if (!hostname) 1154 if (!hostname)
1157 hostname = safe_gethostname(); 1155 hostname = safe_gethostname();
1156 field_names[7] = hostname;
1157
1158 /* index_in_str_array returns i>=0 */ 1158 /* index_in_str_array returns i>=0 */
1159 i = index_in_str_array(field_names, variable); 1159 i = index_in_str_array(field_names, variable);
1160 1160
@@ -1164,12 +1164,11 @@ static const char *get_variable(const char *variable, void *info)
1164 return field_names[i + 7]; 1164 return field_names[i + 7];
1165 1165
1166 if (i == 4) 1166 if (i == 4)
1167 sprintf(sbuf, "%u", gv_info->info->uid); 1167 return auto_string(xasprintf("%u", gv_info->info->uid));
1168 else if (i == 5) 1168 if (i == 5)
1169 sprintf(sbuf, "%u", gv_info->info->gid); 1169 return auto_string(xasprintf("%u", gv_info->info->gid));
1170 else if (i == 6) 1170 /* i == 6 */
1171 sprintf(sbuf, "%o", gv_info->info->mode); 1171 return auto_string(xasprintf("%o", gv_info->info->mode));
1172 return sbuf;
1173} /* End Function get_variable */ 1172} /* End Function get_variable */
1174 1173
1175static void service(struct stat statbuf, char *path) 1174static void service(struct stat statbuf, char *path)