Despite its all autoconfiguration attempts luit needs to manually add
-DBSD to CFLAGS to make this line from sys.c working:
#if (defined(BSD) && !defined(_POSIX_SAVED_IDS)) || defined(_MINIX)
because it immediately quits with
"Couldn't drop privileges: Function not implemented"
otherwise - FreeBSD does not turn _POSIX_SAVED_IDS on.
This has been there since the initial import.
On FreeBSD 7, FreeBSD 8, and NetBSD 5.1:
sys.c includes <unistd.h>
<unistd.h> includes <sys/unistd.h>
* Although we have saved user/group IDs, we do not use them in setuid
* as described in POSIX 1003.1, because the feature does not work for
* root. We use the saved IDs in seteuid/setegid, which are not currently
* part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001
* as this is now mandatory.
#define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */
OpenBSD has _POSIX_SAVED_IDS
I think the old imake build system was setting BSD... nothing sets it any more.
Author: Jeremy Huddleston <email@example.com>
Date: Thu Oct 6 10:50:54 2011 -0700
Fix ifdef-foo for the BSDs which are still living in the 90s
NetBSD and FreeBSD still don't _POSIX_SAVED_IDS
Signed-off-by: Jeremy Huddleston <firstname.lastname@example.org>