chiark / gitweb /
silence gcc warning on 32 bit
[elogind.git] / src / core / execute.c
index 9c2006ebc77efeba283ade75fc9c93135bcd9f28..bbc430e0556d685e79a6188edfeb257d3ceb328e 100644 (file)
@@ -1129,22 +1129,9 @@ int exec_spawn(ExecCommand *command,
                         char_array_0(t);
 
                         if (write_one_line_file("/proc/self/oom_score_adj", t) < 0) {
-                                /* Compatibility with Linux <= 2.6.35 */
-
-                                int adj;
-
-                                adj = (context->oom_score_adjust * -OOM_DISABLE) / OOM_SCORE_ADJ_MAX;
-                                adj = CLAMP(adj, OOM_DISABLE, OOM_ADJUST_MAX);
-
-                                snprintf(t, sizeof(t), "%i", adj);
-                                char_array_0(t);
-
-                                if (write_one_line_file("/proc/self/oom_adj", t) < 0
-                                    && errno != EACCES) {
-                                        err = -errno;
-                                        r = EXIT_OOM_ADJUST;
-                                        goto fail_child;
-                                }
+                                err = -errno;
+                                r = EXIT_OOM_ADJUST;
+                                goto fail_child;
                         }
                 }
 
@@ -1183,7 +1170,7 @@ int exec_spawn(ExecCommand *command,
                                 goto fail_child;
                         }
 
-                if (context->timer_slack_nsec_set)
+                if (context->timer_slack_nsec != (nsec_t) -1)
                         if (prctl(PR_SET_TIMERSLACK, context->timer_slack_nsec) < 0) {
                                 err = -errno;
                                 r = EXIT_TIMERSLACK;
@@ -1494,6 +1481,7 @@ void exec_context_init(ExecContext *c) {
         c->send_sigkill = true;
         c->control_group_persistent = -1;
         c->ignore_sigpipe = true;
+        c->timer_slack_nsec = (nsec_t) -1;
 }
 
 void exec_context_done(ExecContext *c) {
@@ -1739,8 +1727,8 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                 fputs("\n", f);
         }
 
-        if (c->timer_slack_nsec_set)
-                fprintf(f, "%sTimerSlackNSec: %lu\n", prefix, c->timer_slack_nsec);
+        if (c->timer_slack_nsec != (nsec_t) -1)
+                fprintf(f, "%sTimerSlackNSec: %lu\n", prefix, (unsigned long)c->timer_slack_nsec);
 
         fprintf(f,
                 "%sStandardInput: %s\n"