From 64325b38629df677f15e43a3cf1ea65c2db1875c Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Mon, 16 Oct 2017 15:19:07 +0200 Subject: [PATCH] user: remove static from idx vars, it causes crash after many iterations of nsjail --- nsjail.c | 4 ++-- user.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nsjail.c b/nsjail.c index ca573677..80428aa1 100644 --- a/nsjail.c +++ b/nsjail.c @@ -101,8 +101,8 @@ static bool nsjailSetTimer(struct nsjconf_t* nsjconf) } struct itimerval it = { - .it_value = {.tv_sec = 1, .tv_usec = 0 }, - .it_interval = {.tv_sec = 1, .tv_usec = 0 }, + .it_value = { .tv_sec = 1, .tv_usec = 0 }, + .it_interval = { .tv_sec = 1, .tv_usec = 0 }, }; if (setitimer(ITIMER_REAL, &it, NULL) == -1) { PLOG_E("setitimer(ITIMER_REAL)"); diff --git a/user.c b/user.c index 9f5815a2..63cc684c 100644 --- a/user.c +++ b/user.c @@ -65,7 +65,7 @@ static bool userUidMapSelf(struct nsjconf_t* nsjconf, pid_t pid) char fname[PATH_MAX]; snprintf(fname, sizeof(fname), "/proc/%d/uid_map", pid); - char map[4096] = {[0] = '\0' }; + char map[4096] = { [0] = '\0' }; struct idmap_t* p; TAILQ_FOREACH(p, &nsjconf->uids, pointers) @@ -95,7 +95,7 @@ static bool userGidMapSelf(struct nsjconf_t* nsjconf, pid_t pid) char fname[PATH_MAX]; snprintf(fname, sizeof(fname), "/proc/%d/gid_map", pid); - char map[4096] = {[0] = '\0' }; + char map[4096] = { [0] = '\0' }; struct idmap_t* p; TAILQ_FOREACH(p, &nsjconf->gids, pointers) @@ -123,7 +123,7 @@ static bool userGidMapSelf(struct nsjconf_t* nsjconf, pid_t pid) /* Use /usr/bin/newgidmap for writing the gid map */ static bool userGidMapExternal(struct nsjconf_t* nsjconf, pid_t pid UNUSED) { - static size_t idx = 0; + size_t idx = 0; const char* argv[1024]; char parms[1024][256]; @@ -177,7 +177,7 @@ static bool userGidMapExternal(struct nsjconf_t* nsjconf, pid_t pid UNUSED) /* Use /usr/bin/newuidmap for writing the uid map */ static bool userUidMapExternal(struct nsjconf_t* nsjconf, pid_t pid UNUSED) { - static size_t idx = 0; + size_t idx = 0; const char* argv[1024]; char parms[1024][256];