diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 23:10:01 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-20 23:10:01 +0200 |
commit | 268149290fcd8a52f377b21226990d3bf0e9c226 (patch) | |
tree | 65b57e4214386aa52602d62d133b9ec32efc44f4 | |
parent | 4b1a0ddadc70fbce76844bf09af261296ef4fd9f (diff) |
reduce stack usage
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | proto-shell.c | 4 | ||||
-rw-r--r-- | system-linux.c | 4 |
3 files changed, 5 insertions, 5 deletions
@@ -98,7 +98,7 @@ retry: cur = buf; buf = proc->log_buf; - while ((cur = memchr(cur, '\n', len))) { + while (len > 0 && (cur = memchr(cur, '\n', len))) { *cur = 0; if (!proc->log_overflow) diff --git a/proto-shell.c b/proto-shell.c index c2a6d00..3b5311c 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -332,8 +332,8 @@ out: static int proto_shell_run_command(struct proto_shell_state *state, struct blob_attr **tb) { - char *argv[64]; - char *env[32]; + static char *argv[64]; + static char *env[32]; if (!tb[NOTIFY_COMMAND]) goto error; diff --git a/system-linux.c b/system-linux.c index 44332a2..8b9189d 100644 --- a/system-linux.c +++ b/system-linux.c @@ -101,7 +101,7 @@ static void system_set_sysctl(const char *path, const char *val) static void system_set_dev_sysctl(const char *path, const char *device, const char *val) { - char buf[256]; + static char buf[256]; snprintf(buf, sizeof(buf), path, val); system_set_sysctl(buf, val); @@ -367,7 +367,7 @@ out: */ void system_if_clear_state(struct device *dev) { - char buf[256]; + static char buf[256]; char *bridge; if (dev->external) |