]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chrt: fix HAVE_SCHED_SETATTR fallback case
authorRuediger Meier <ruediger.meier@ga-group.nl>
Wed, 26 Oct 2016 17:46:22 +0000 (19:46 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 27 Oct 2016 09:03:21 +0000 (11:03 +0200)
Broken since 6f27e449. We could not enter the fallback
if HAVE_SCHED_SETATTR is not defined.

Two gcc warnings made this issue visible:
  schedutils/chrt.c:247:1: warning: label 'fallback' defined but not used [-Wunused-label]
  schedutils/chrt.c:266:9: warning: 'policy' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
schedutils/chrt.c

index 0a51c1088ca78e89e078b82304a17f1da32b8e9b..a861d9f75a52740626fb3b607cf05ed2f1ed80e0 100644 (file)
@@ -239,13 +239,14 @@ static void show_sched_pid_info(struct chrt_ctl *ctl, pid_t pid)
                runtime = sa.sched_runtime;
                period = sa.sched_period;
        }
-#endif
 
        /*
         * Old way
         */
 fallback:
-       if (errno == ENOSYS) {
+       if (errno == ENOSYS)
+#endif
+       {
                struct sched_param sp;
 
                policy = sched_getscheduler(pid);