Skip Menu |

From: Todd Lubin <>
Date: Wed, 1 Nov 2017 15:29:16 -0400
Subject: ksu doesn't exit nonzero
There is a bug in ksu where it fails to exit with a nonzero status if it forks a child to run the command and the child exits nonzero.

For example:
$ su user1
$ echo 'user2@REALM *' > ~/.k5users
$ su user2
$ kinit user2
$ ksu user1 -e /file-that-does-not-exist

In the above example, ksu exits with status code 0.

The problem is that ksu calls:

waitpid(child_pid, &statusp, WUNTRACED)
exit (statusp);

but should be calling:
exit (WEXITSTATUS(statusp));

Subject: git commit

Properly mirror child exit status in ksu

ksu attempts to exit with the same status as its child process, but
does not do so correctly. Use WEXITSTATUS() to extract the exit code.
Reported by Todd Lubin.
Author: Greg Hudson <>
Commit: 03c7df6fc683c68975db46c7afaa24f1a9a05fae
Branch: master
src/clients/ksu/main.c | 2 +-
src/clients/ksu/ | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)