From 9639caf1174b5306c331777e8ad124955edb2c7c Mon Sep 17 00:00:00 2001 From: Charles Forsyth Date: Wed, 11 Mar 2020 16:42:21 +0000 Subject: [PATCH] define this and that to answer warnings --- authrhosts.c | 1 + plan9.h | 2 ++ u9fs.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/authrhosts.c b/authrhosts.c index de15085..2430e6f 100644 --- a/authrhosts.c +++ b/authrhosts.c @@ -1,6 +1,7 @@ #include #include #include +#include /* * return whether the user is authenticated. diff --git a/plan9.h b/plan9.h index 60b03a9..50faf8e 100644 --- a/plan9.h +++ b/plan9.h @@ -9,6 +9,8 @@ /* magic to get 64-bit stat on Linux, maybe others */ #define _FILE_OFFSET_BITS 64 +#define _DEFAULT_SOURCE 1 /* also for ruserok */ + #ifdef sgi #define _BSD_TYPES 1 /* for struct timeval */ #include diff --git a/u9fs.c b/u9fs.c index 1856e1b..ae06496 100644 --- a/u9fs.c +++ b/u9fs.c @@ -1430,7 +1430,9 @@ groupchange(User *u, User *g, char **ep) return -1; } - setreuid(0,0); + if(setreuid(0, 0) < 0){ + /* can't get super-user, other calls will fail */ + } if(setregid(-1, g->id) < 0){ fprint(2, "setegid(%s/%d) failed in groupchange\n", g->name, g->id); *ep = strerror(errno);