Use uint64_t instead of __rlim64_t
authorRobert Swiecki <robert@swiecki.net>
Wed, 25 Oct 2017 13:44:35 +0000 (15:44 +0200)
committerRobert Swiecki <robert@swiecki.net>
Wed, 25 Oct 2017 13:44:35 +0000 (15:44 +0200)
cgroup.c
cmdline.c
cmdline.h
nsjail.h

index b74b2cf40126adc0a50a389d1bc8d2026938ecdf..99fa007c3654dc88300c74fea597535bd449f627 100644 (file)
--- a/cgroup.c
+++ b/cgroup.c
@@ -141,11 +141,12 @@ static bool cgroupInitNsFromParentNetCls(struct nsjconf_t* nsjconf, pid_t pid)
        char fname[PATH_MAX];
        if (nsjconf->cgroup_net_cls_classid != (unsigned int)0) {
                char net_cls_classid_str[512];
-               snprintf(net_cls_classid_str, sizeof(net_cls_classid_str), "0x%x", nsjconf->cgroup_net_cls_classid);
+               snprintf(net_cls_classid_str, sizeof(net_cls_classid_str), "0x%x",
+                   nsjconf->cgroup_net_cls_classid);
                snprintf(fname, sizeof(fname), "%s/net_cls.classid", net_cls_cgroup_path);
                LOG_D("Setting '%s' to '%s'", fname, net_cls_classid_str);
-               if (!utilWriteBufToFile(
-                       fname, net_cls_classid_str, strlen(net_cls_classid_str), O_WRONLY | O_CLOEXEC)) {
+               if (!utilWriteBufToFile(fname, net_cls_classid_str, strlen(net_cls_classid_str),
+                       O_WRONLY | O_CLOEXEC)) {
                        LOG_E("Could not update net_cls cgroup classid");
                        return false;
                }
index 513236da4af608a9b4b854a3b1cd1ae07428d8de..7681ecc5f329830d65dc60a88a062f2329bd691c 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -261,7 +261,7 @@ void cmdlineLogParams(struct nsjconf_t* nsjconf)
        }
 }
 
-__rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
+uint64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
 {
        if (strcasecmp(optarg, "inf") == 0) {
                return RLIM64_INFINITY;
@@ -281,7 +281,7 @@ __rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul)
                      "provided)",
                    res, optarg);
        }
-       __rlim64_t val = strtoull(optarg, NULL, 0) * mul;
+       uint64_t val = strtoull(optarg, NULL, 0) * mul;
        if (val == ULLONG_MAX && errno != 0) {
                PLOG_F("strtoul('%s', 0)", optarg);
        }
index d107d1f83cadaf86af9f9b4746d753e162bf7a55..61dae5459fd3ac9162ad967b6f260d15c72c63a4 100644 (file)
--- a/cmdline.h
+++ b/cmdline.h
@@ -29,7 +29,7 @@
 
 #include "nsjail.h"
 
-__rlim64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul);
+uint64_t cmdlineParseRLimit(int res, const char* optarg, unsigned long mul);
 void cmdlineLogParams(struct nsjconf_t* nsjconf);
 bool cmdlineParse(int argc, char* argv[], struct nsjconf_t* nsjconf);
 
index 107cbb8a2d5f247ac7c0a3784c9f5fa55670b455..d9a8ad992e3580c730b0c33378c506539f4bb64a 100644 (file)
--- a/nsjail.h
+++ b/nsjail.h
@@ -123,13 +123,13 @@ struct nsjconf_t {
        bool keep_env;
        bool keep_caps;
        bool disable_no_new_privs;
-       __rlim64_t rl_as;
-       __rlim64_t rl_core;
-       __rlim64_t rl_cpu;
-       __rlim64_t rl_fsize;
-       __rlim64_t rl_nofile;
-       __rlim64_t rl_nproc;
-       __rlim64_t rl_stack;
+       uint64_t rl_as;
+       uint64_t rl_core;
+       uint64_t rl_cpu;
+       uint64_t rl_fsize;
+       uint64_t rl_nofile;
+       uint64_t rl_nproc;
+       uint64_t rl_stack;
        unsigned long personality;
        bool clone_newnet;
        bool clone_newuser;