From: ianmdlvl Date: Sun, 16 May 2004 14:47:38 +0000 (+0000) Subject: allow root to run really; make checkroot return goodness or not X-Git-Tag: debian_version_4_0_99_0_6~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=commitdiff_plain;h=874f982f8799ffcaa649a42a4faf4f2e71faa8c0 allow root to run really; make checkroot return goodness or not --- 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);