asserts
[oweals/gnunet.git] / src / util / os_priority.c
index e57d11d63f4a985cab664c5aeb72617163b18172..77b2627035f06426cb559842445084865d2fe52b 100644 (file)
@@ -62,8 +62,6 @@ GNUNET_OS_set_process_priority (pid_t proc,
                                 enum GNUNET_SCHEDULER_Priority prio)
 {
   int rprio = 0;
-  int have;
-  int delta;
 
   GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT);
   if (prio == GNUNET_SCHEDULER_PRIORITY_KEEP)
@@ -118,15 +116,15 @@ GNUNET_OS_set_process_priority (pid_t proc,
   /* Set process priority */
 #ifdef MINGW
   SetPriorityClass (GetCurrentProcess (), rprio);
-#else
+#elif LINUX 
   if ( (0 == proc) ||
        (proc == getpid () ) )
     {
-      have = nice (0);
-      delta = rprio - have;
+      int have = nice (0);
+      int delta = rprio - have;
       errno = 0;
-      if ( (rprio != 0) &&
-          (-1 == nice (delta)) && 
+      if ( (delta != 0) &&
+          (rprio == nice (delta)) && 
           (errno != 0) )
         {
           GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
@@ -144,6 +142,9 @@ GNUNET_OS_set_process_priority (pid_t proc,
           return GNUNET_SYSERR;
         }
     }
+#else
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+             "Priority management not availabe for this platform\n");
 #endif
   return GNUNET_OK;
 }