Error out at runtime when seteuid/setresuid or setegid/setresgid are not
authorJelmer Vernooij <jelmer@samba.org>
Mon, 20 Apr 2009 13:54:02 +0000 (15:54 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 20 Apr 2009 14:25:17 +0000 (16:25 +0200)
available. This means it's possible to compile libreplace when these
functions are not available and use it, as long as this particular
function is not used.

lib/replace/replace.c

index be277445923ac43d131464d8b7fcaa4dae951e8f..fc15717349e1d189dcd9494d1bc2dd61e12ca92c 100644 (file)
@@ -372,7 +372,8 @@ int rep_seteuid(uid_t euid)
 #ifdef HAVE_SETRESUID
        return setresuid(-1, euid, -1);
 #else
-#  error "You need a seteuid function"
+       errno = ENOSYS;
+       return -1;
 #endif
 }
 #endif
@@ -383,7 +384,8 @@ int rep_setegid(gid_t egid)
 #ifdef HAVE_SETRESGID
        return setresgid(-1, egid, -1);
 #else
-#  error "You need a setegid function"
+       errno = ENOSYS;
+       return -1;
 #endif
 }
 #endif