From 00e3c0f1bbe99682debd4e34d3d3bd950f8c30cb Mon Sep 17 00:00:00 2001 From: mdw Date: Fri, 24 Jan 2003 20:12:40 +0000 Subject: [PATCH] Correctly cast uid and gid sentinel values. --- fw.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fw.c b/fw.c index c2c345c..b0eed70 100644 --- a/fw.c +++ b/fw.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: fw.c,v 1.13 2002/02/22 23:45:20 mdw Exp $ + * $Id: fw.c,v 1.14 2003/01/24 20:12:40 mdw Exp $ * * Port forwarding thingy * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: fw.c,v $ + * Revision 1.14 2003/01/24 20:12:40 mdw + * Correctly cast uid and gid sentinel values. + * * Revision 1.13 2002/02/22 23:45:20 mdw * Add option to change the listen(2) parameter. Receive `fw'-specific * code from `conf.c'. @@ -797,12 +800,12 @@ int main(int argc, char *argv[]) /* --- Drop privileges --- */ #ifdef HAVE_SETGROUPS - if ((dropg != -1 && (setgid(dropg) || setgroups(1, &dropg))) || - (drop != -1 && setuid(drop))) + if ((dropg != (gid_t)-1 && (setgid(dropg) || setgroups(1, &dropg))) || + (drop != (uid_t)-1 && setuid(drop))) die(1, "couldn't drop privileges: %s", strerror(errno)); #else - if ((dropg != -1 && setgid(dropg)) || - (drop != -1 && setuid(drop))) + if ((dropg != (gid_t)-1 && setgid(dropg)) || + (drop != (uid_t)-1 && setuid(drop))) die(1, "couldn't drop privileges: %s", strerror(errno)); #endif -- 2.11.0