No need to use '== true'
authorRobert Swiecki <robert@swiecki.net>
Wed, 18 Oct 2017 13:41:16 +0000 (15:41 +0200)
committerRobert Swiecki <robert@swiecki.net>
Wed, 18 Oct 2017 13:41:16 +0000 (15:41 +0200)
caps.c
contain.c
log.c
nsjail.c
subproc.c

diff --git a/caps.c b/caps.c
index f785f6e91c41b5e368dd604c89207e8329941273..5148bf1eeb8238fcb5c5986b33df44bbe6d2970d 100644 (file)
--- a/caps.c
+++ b/caps.c
@@ -177,7 +177,7 @@ static bool CapsInitNsKeepCaps(cap_user_data_t cap_data)
        /* Copy all permitted caps to the inheritable set */
        dbgmsg[0] = '\0';
        for (size_t i = 0; i < ARRAYSIZE(capNames); i++) {
-               if (capsGetPermitted(cap_data, capNames[i].val) == true) {
+               if (capsGetPermitted(cap_data, capNames[i].val)) {
                        utilSSnPrintf(dbgmsg, sizeof(dbgmsg), " %s", capNames[i].name);
                        capsSetInheritable(cap_data, capNames[i].val);
                }
@@ -254,10 +254,10 @@ bool capsInitNs(struct nsjconf_t* nsjconf)
         * Make sure all other caps (those which were not explicitly requested) are removed from the
         * bounding set. We need to have CAP_SETPCAP to do that now
         */
-       if (capsGetEffective(cap_data, CAP_SETPCAP) == true) {
+       if (capsGetEffective(cap_data, CAP_SETPCAP)) {
                dbgmsg[0] = '\0';
                for (size_t i = 0; i < ARRAYSIZE(capNames); i++) {
-                       if (capsGetInheritable(cap_data, capNames[i].val) == true) {
+                       if (capsGetInheritable(cap_data, capNames[i].val)) {
                                continue;
                        }
                        utilSSnPrintf(dbgmsg, sizeof(dbgmsg), " %s", capNames[i].name);
index bf4c5e84bbf442e6392086249e4a582f6512643f..09b38d5d7ee6a86b7e42e45625e32d93c63a1c7a 100644 (file)
--- a/contain.c
+++ b/contain.c
@@ -245,10 +245,10 @@ static bool containMakeFdsCOEProc(struct nsjconf_t* nsjconf)
 
 static bool containMakeFdsCOE(struct nsjconf_t* nsjconf)
 {
-       if (containMakeFdsCOEProc(nsjconf) == true) {
+       if (containMakeFdsCOEProc(nsjconf)) {
                return true;
        }
-       if (containMakeFdsCOENaive(nsjconf) == true) {
+       if (containMakeFdsCOENaive(nsjconf)) {
                return true;
        }
        LOG_E("Couldn't mark relevant file-descriptors as close-on-exec with any known method");
diff --git a/log.c b/log.c
index b307d9ce68925e634fe6b6cf55fcacab26cfbb20..b63093d413a805e1eeaf3e0e9105dd8a82ff05f0 100644 (file)
--- a/log.c
+++ b/log.c
@@ -57,7 +57,7 @@ bool logInitLogFile(struct nsjconf_t* nsjconf)
        log_fd = nsjconf->log_fd;
        log_level = nsjconf->loglevel;
 
-       if (nsjconf->logfile == NULL && nsjconf->daemonize == true) {
+       if (nsjconf->logfile == NULL && nsjconf->daemonize) {
                nsjconf->logfile = _LOG_DEFAULT_FILE;
        }
        if (nsjconf->logfile == NULL) {
@@ -82,7 +82,7 @@ void logLog(enum llevel_t ll, const char* fn, int ln, bool perr, const char* fmt
        }
 
        char strerr[512];
-       if (perr == true) {
+       if (perr) {
                snprintf(strerr, sizeof(strerr), "%s", strerror(errno));
        }
        struct ll_t {
@@ -124,7 +124,7 @@ void logLog(enum llevel_t ll, const char* fn, int ln, bool perr, const char* fmt
        va_start(args, fmt);
        vdprintf(log_fd, fmt, args);
        va_end(args);
-       if (perr == true) {
+       if (perr) {
                dprintf(log_fd, ": %s", strerr);
        }
        if (log_fd_isatty) {
index a72d4f9053a431b25723c09974aa7f91a656764a..15ee203ed60789d86c434a1da7aee2a00f0292dd 100644 (file)
--- a/nsjail.c
+++ b/nsjail.c
@@ -119,7 +119,7 @@ static void nsjailListenMode(struct nsjconf_t* nsjconf)
                        close(listenfd);
                        return;
                }
-               if (nsjailShowProc == true) {
+               if (nsjailShowProc) {
                        nsjailShowProc = false;
                        subprocDisplay(nsjconf);
                }
@@ -145,7 +145,7 @@ static int nsjailStandaloneMode(struct nsjconf_t* nsjconf)
                        subprocRunChild(nsjconf, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO);
                        continue;
                }
-               if (nsjailShowProc == true) {
+               if (nsjailShowProc) {
                        nsjailShowProc = false;
                        subprocDisplay(nsjconf);
                }
index 2684a8ea78ae02bf220a0abaef1b7c8f0c72c5af..61c272621e7bc9f49a1c09839803157262bd69c2 100644 (file)
--- a/subproc.c
+++ b/subproc.c
@@ -534,7 +534,7 @@ int subprocSystem(const char** argv, char** env)
                if (WIFEXITED(status)) {
                        int exit_code = WEXITSTATUS(status);
                        LOG_D("PID %d exited with exit code: %d", pid, exit_code);
-                       if (exec_failed == true) {
+                       if (exec_failed) {
                                return -1;
                        } else if (exit_code == 0) {
                                return 0;