cmdline: no need to check for nice values
authorRobert Swiecki <robert@swiecki.net>
Sun, 30 Jun 2019 20:03:57 +0000 (22:03 +0200)
committerRobert Swiecki <robert@swiecki.net>
Sun, 30 Jun 2019 20:03:57 +0000 (22:03 +0200)
cmdline.cc
contain.cc

index 1ddd6ce..ed31a62 100644 (file)
@@ -834,10 +834,6 @@ std::unique_ptr<nsjconf_t> parseArgs(int argc, char* argv[]) {
                        break;
                case 0x903:
                        nsjconf->nice_level = (int)strtol(optarg, NULL, 0);
-                       if ((nsjconf->nice_level < -20) || (nsjconf->nice_level > -20)) {
-                               LOG_W("Incorrect niceness setting!");
-                               nsjconf->nice_level = 19;
-                       }
                        break;
                default:
                        cmdlineUsage(argv[0]);
index 5e9ee88..7ef2bb3 100644 (file)
@@ -100,9 +100,10 @@ static bool containPrepareEnv(nsjconf_t* nsjconf) {
                PLOG_E("personality(%lx)", nsjconf->personality);
                return false;
        }
+       LOG_D("setpriority(%d)", nsjconf->nice_level);
        errno = 0;
        if (setpriority(PRIO_PROCESS, 0, nsjconf->nice_level) == -1 && errno != 0) {
-               PLOG_W("setpriority(%" PRId32 ")", nsjconf->nice_level);
+               PLOG_W("setpriority(%d)", nsjconf->nice_level);
        }
        if (!nsjconf->skip_setsid) {
                setsid();