"max_conns_per_ip:%u, uid:%u, gid:%u, time_limit:%ld, personality:%#lx, daemonize:%s, "
"clone_newnet:%s, clone_newuser:%s, clone_newns:%s, clone_newpid:%s, "
"clone_newipc:%s, clonew_newuts:%s, apply_sandbox:%s, keep_caps:%s, "
- "tmpfs_size:%u",
+ "tmpfs_size:%zu",
nsjconf->hostname, nsjconf->chroot, nsjconf->argv[0], nsjconf->port,
nsjconf->max_conns_per_ip, nsjconf->uid, nsjconf->gid, nsjconf->tlimit,
nsjconf->personality, logYesNo(nsjconf->daemonize), logYesNo(nsjconf->clone_newnet),
.initial_uid = getuid(),
.initial_gid = getgid(),
.max_conns_per_ip = 0,
- .tmpfs_size = 4*1024*1024,
+ .tmpfs_size = 4 * (1024 * 1024),
};
/* *INDENT-OFF* */
nsjconf->max_conns_per_ip = strtoul(optarg, NULL, 0);
break;
case 0x0506:
- nsjconf->tmpfs_size = strtoul(optarg, NULL, 0);
+ nsjconf->tmpfs_size = strtoull(optarg, NULL, 0);
break;
case 'u':
user = optarg;
uid_t initial_uid;
gid_t initial_gid;
unsigned int max_conns_per_ip;
- unsigned int tmpfs_size;
+ size_t tmpfs_size;
LIST_HEAD(pidslist, pids_t) pids;
LIST_HEAD(rwbindmountptslist, constchar_t) rwbindmountpts;
LIST_HEAD(robindmountptslist, constchar_t) robindmountpts;
/* findSpecDestination mutates spec (source:dest) to have a null byte instead
* of ':' in between source and dest, then returns a pointer to the dest
* string. */
-static char *findSpecDestination(char *spec) {
+static char *findSpecDestination(char *spec)
+{
char *dest = spec;
while (*dest != ':' && *dest != '\0') {
dest++;
}
}
-static bool bindMount(const char *newrootdir, const char *spec) {
+static bool bindMount(const char *newrootdir, const char *spec)
+{
char mount_pt[PATH_MAX];
bool success = false;
char *source = strdup(spec);
}
success = true;
-cleanup:
+ cleanup:
free(source);
return success;
}
-static bool remountBindMount(const char *spec, unsigned long flags) {
+static bool remountBindMount(const char *spec, unsigned long flags)
+{
bool success = false;
char *source = strdup(spec);
char *dest = findSpecDestination(source);
}
success = true;
-cleanup:
+ cleanup:
free(source);
return success;
}
/* It only makes sense with "--chroot /", so don't worry about errors */
umount2(destdir, MNT_DETACH);
- char tmpfs_size[11+5];
- snprintf(tmpfs_size, sizeof(tmpfs_size), "size=%u", nsjconf->tmpfs_size);
+ char tmpfs_size[128];
+ snprintf(tmpfs_size, sizeof(tmpfs_size), "size=%zu", nsjconf->tmpfs_size);
LIST_FOREACH(p, &nsjconf->tmpfsmountpts, pointers) {
if (strchr(p->value, ':') != NULL) {
PLOG_E("invalid tmpfs mount spec. source:dest format unsupported.");
}
if (nsjconf->is_root_rw == false) {
- if (mount
- ("/", "/", NULL, MS_BIND | MS_RDONLY | MS_NOSUID | MS_REMOUNT | MS_PRIVATE,
- NULL) == -1) {
+ if (mount("/", "/", NULL, MS_BIND | MS_RDONLY | MS_NOSUID | MS_REMOUNT | MS_PRIVATE, NULL) == -1) {
PLOG_E("mount('/', '/', MS_BIND|MS_RDONLY|MS_NOSUID|MS_REMOUNT|MS_PRIVATE)");
return false;
}
}
}
-
return true;
}