Fixups to nice handling. Users can't normally lower niceness.

This commit is contained in:
Peter Hyman 2019-11-26 04:35:26 -06:00
parent 02a7bdc6c4
commit 9b20563ef5
3 changed files with 26 additions and 12 deletions

View file

@ -1276,9 +1276,10 @@ static void *compthread(void *data)
cti = &cthread[i];
ctis = cti->sinfo;
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1))
print_err("Warning, unable to set nice value on thread\n");
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, current_priority);
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
}
cti->c_type = CTYPE_NONE;
cti->c_len = cti->s_len;
@ -1512,8 +1513,10 @@ static void *ucompthread(void *data)
dealloc(data);
uci = &ucthread[i];
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1))
print_err("Warning, unable to set nice value on thread\n");
if (unlikely(setpriority(PRIO_PROCESS, 0, control->nice_val) == -1)) {
print_err("Warning, unable to set thread nice value %d...Resetting to %d\n", control->nice_val, current_priority);
setpriority(PRIO_PROCESS, 0, (control->nice_val=current_priority));
}
retry:
if (uci->c_type != CTYPE_NONE) {