ujail: fixup code style: "func()" -> "func(void)"
[project/procd.git] / jail / jail.c
index e8c8f08..b7e6946 100644 (file)
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <sched.h>
+#include <linux/limits.h>
 
 #include "elf.h"
 #include "capabilities.h"
@@ -93,8 +94,8 @@ static int mount_bind(const char *root, const char *path, const char *name, int
 {
        const char *p = path;
        struct stat s;
-       char old[256];
-       char new[256];
+       char old[PATH_MAX];
+       char new[PATH_MAX];
        int fd;
 
        if (strstr(p, "local"))
@@ -138,7 +139,7 @@ static int mount_bind(const char *root, const char *path, const char *name, int
        return 0;
 }
 
-static int build_jail_fs()
+static int build_jail_fs(void)
 {
        struct library *l;
        struct extra *m;
@@ -153,11 +154,7 @@ static int build_jail_fs()
                return -1;
        }
 
-       avl_init(&libraries, avl_strcmp, false, NULL);
-       alloc_library_path("/lib");
-       alloc_library_path("/lib64");
-       alloc_library_path("/usr/lib");
-       load_ldso_conf("/etc/ld.so.conf");
+       init_library_search();
 
        if (elf_load_deps(*opts.jail_argv)) {
                ERROR("failed to load dependencies\n");
@@ -209,8 +206,8 @@ static int build_jail_fs()
 static char** build_envp(const char *seccomp)
 {
        static char *envp[MAX_ENVP];
-       static char preload_var[64];
-       static char seccomp_var[64];
+       static char preload_var[PATH_MAX];
+       static char seccomp_var[PATH_MAX];
        static char debug_var[] = "LD_DEBUG=all";
        const char *preload_lib = find_lib("libpreload-seccomp.so");
        int count = 0;
@@ -256,7 +253,7 @@ ujail will not use namespace/build a jail,\n\
 and will only drop capabilities/apply seccomp filter.\n\n");
 }
 
-static int exec_jail()
+static int exec_jail(void)
 {
        char **envp = build_envp(opts.seccomp);
        if (!envp)