'root' as a special case in UTIL_IsExecuteBitsSet (dotnet/coreclr#10246)
authorJonghyun Park <parjong@gmail.com>
Tue, 21 Mar 2017 00:14:02 +0000 (09:14 +0900)
committerJan Kotas <jkotas@microsoft.com>
Tue, 21 Mar 2017 00:14:02 +0000 (17:14 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/cd9b5e782f6e9b1f392e028c819ed538546311eb

src/coreclr/src/pal/src/misc/utils.cpp

index f0ff634..4eefd74 100644 (file)
@@ -124,7 +124,12 @@ BOOL UTIL_IsExecuteBitsSet( struct stat * stat_data )
     }
     
     /* Check for read permissions. */
-    if ( stat_data->st_uid == geteuid() )
+    if ( 0 == geteuid() )
+    {
+        /* The process owner is root */
+        bRetVal = TRUE;
+    }
+    else if ( stat_data->st_uid == geteuid() )
     {
         /* The process owner is the file owner as well. */
         if ( ( stat_data->st_mode & S_IXUSR ) )