From 874f982f8799ffcaa649a42a4faf4f2e71faa8c0 Mon Sep 17 00:00:00 2001 From: ianmdlvl Date: Sun, 16 May 2004 14:47:38 +0000 Subject: [PATCH] allow root to run really; make checkroot return goodness or not --- cprogs/really.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cprogs/really.c b/cprogs/really.c index d6ea15b..1b4f190 100644 --- a/cprogs/really.c +++ b/cprogs/really.c @@ -98,28 +98,30 @@ static const struct cmdinfo cmdinfos[]= { }; #ifdef REALLY_CHECK_FILE -static void checkroot(void) { +static int checkroot(void) { int r; r= access(REALLY_CHECK_FILE,W_OK); - if (r) { perror("sorry"); exit(-1); } + if (r) return -1; + return 0; } #endif #ifdef REALLY_CHECK_GID -static void checkroot(void) { +static int checkroot(void) { gid_t groups[512]; int r, i; - r= getgid(); if (r==REALLY_CHECK_GID) return; + r= getgid(); if (r==REALLY_CHECK_GID) return 0; if (r<0) { perror("getgid check"); exit(-1); } r= getgroups(sizeof(groups)/sizeof(groups[0]),groups); if (r<0) { perror("getgroups check"); exit(-1); } for (i=0; ipw_gid); -- 2.30.2