From f5419cbed82197983e09e453b3c36f4d0b71b24c Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 30 Dec 2005 14:36:30 +0000 Subject: [PATCH] only use getuid if it is actually available ... git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@735 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_tool.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c index 22eb62f0..2e0bf9cf 100644 --- a/program/src/rrd_tool.c +++ b/program/src/rrd_tool.c @@ -326,7 +326,15 @@ int main(int argc, char *argv[]) #endif RemoteMode=1; if ((argc == 3) && strcmp("",argv[2])){ - if (getuid()==0){ + + if ( +#ifdef HAVE_GETUID + getuid() +#else + 1 +#endif + == 0 ){ + #ifdef HAVE_CHROOT chroot(argv[2]); if (errno!=0){ @@ -435,7 +443,7 @@ int HandleInputLine(int argc, char **argv, FILE* out) #if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID) if (getuid()==0 && ! ChangeRoot){ printf("ERROR: chdir security problem - rrdtool is running as " - "root an no chroot!\n"); + "root but not chroot!\n"); return(1); } #endif @@ -454,7 +462,7 @@ int HandleInputLine(int argc, char **argv, FILE* out) #if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID) if (getuid()==0 && ! ChangeRoot){ printf("ERROR: mkdir security problem - rrdtool is running as " - "root an no chroot!\n"); + "root but not chroot!\n"); return(1); } #endif -- 2.30.2