From 5f5778fabce271e9c1e5f06d6e588c5bb092d889 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/program@735 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_tool.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 22eb62f..2e0bf9c 100644 --- a/src/rrd_tool.c +++ b/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.11.0