aboutsummaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
committerRon Yorston <rmy@pobox.com>2019-05-27 11:56:52 +0100
commita61949401890cbb33a9d6c4571b51c53460ad438 (patch)
tree64dedaddb89896d5b1670a421af123670ca2120b /networking/ifupdown.c
parent03a7b173605a890e1db5177ecd5b8dd591081c41 (diff)
parentbcb1fc3e6ca6fe902610f507eaf9b0b58a5c583a (diff)
downloadbusybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.gz
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.tar.bz2
busybox-w32-a61949401890cbb33a9d6c4571b51c53460ad438.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 8a6efc976..5327b0979 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1177,8 +1177,15 @@ static int doit(char *str)
1177 1177
1178static int execute_all(struct interface_defn_t *ifd, const char *opt) 1178static int execute_all(struct interface_defn_t *ifd, const char *opt)
1179{ 1179{
1180 /* 'opt' is always short, the longest value is "post-down".
1181 * Can use on-stack buffer instead of xasprintf'ed one.
1182 */
1183 char buf[sizeof("run-parts /etc/network/if-%s.d")
1184 + sizeof("post-down")
1185 /*paranoia:*/ + 8
1186 ];
1180 int i; 1187 int i;
1181 char *buf; 1188
1182 for (i = 0; i < ifd->n_options; i++) { 1189 for (i = 0; i < ifd->n_options; i++) {
1183 if (strcmp(ifd->option[i].name, opt) == 0) { 1190 if (strcmp(ifd->option[i].name, opt) == 0) {
1184 if (!doit(ifd->option[i].value)) { 1191 if (!doit(ifd->option[i].value)) {
@@ -1192,8 +1199,7 @@ static int execute_all(struct interface_defn_t *ifd, const char *opt)
1192 * complains, and this message _is_ annoyingly visible. 1199 * complains, and this message _is_ annoyingly visible.
1193 * Don't "fix" this (unless newer Debian does). 1200 * Don't "fix" this (unless newer Debian does).
1194 */ 1201 */
1195 buf = xasprintf("run-parts /etc/network/if-%s.d", opt); 1202 sprintf(buf, "run-parts /etc/network/if-%s.d", opt);
1196 /* heh, we don't bother free'ing it */
1197 return doit(buf); 1203 return doit(buf);
1198} 1204}
1199 1205