diff --git a/src/XrdCl/XrdClUtils.hh b/src/XrdCl/XrdClUtils.hh index 2ae8c013ba5..cf076e5220e 100644 --- a/src/XrdCl/XrdClUtils.hh +++ b/src/XrdCl/XrdClUtils.hh @@ -252,6 +252,13 @@ namespace XrdCl pPrevFsUid = -1; pPrevFsGid = -1; + //---------------------------------------------------------------------- + //! Do nothing if we aren't root + //---------------------------------------------------------------------- + if(!isRoot()) { + return; + } + //---------------------------------------------------------------------- //! Set fsuid //---------------------------------------------------------------------- @@ -299,6 +306,17 @@ namespace XrdCl } private: + bool isRoot() const { + uid_t ruid, euid, suid; + if(getresuid(&ruid, &euid, &suid) != 0) { + Log *log = DefaultEnv::GetLog(); + log->Error(XRootDTransportMsg, "[%s] Could not determine effective uid", pStreamName.c_str()); + return true; + } + + return (euid == 0); + } + int pFsUid; int pFsGid;