Skip to content

Commit

Permalink
user: remove static from idx vars, it causes crash after many iterati…
Browse files Browse the repository at this point in the history
…ons of nsjail
  • Loading branch information
robertswiecki committed Oct 16, 2017
1 parent 6a9cbc0 commit 64325b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nsjail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand Down
8 changes: 4 additions & 4 deletions user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 64325b3

Please sign in to comment.