Chromium Code Reviews| Index: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc |
| diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc |
| index b7cc45a8b536650f06a1eaa3352356793256857f..8e3d85ea7b9a3b72c0b914921b804709014e5b32 100644 |
| --- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc |
| +++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc |
| @@ -4,6 +4,14 @@ |
| #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" |
| +#if defined(OS_LINUX) |
|
Tom (Use chromium acct)
2017/02/19 19:16:06
Move ifdef'ed includes to the bottom
Kevin Cernekee
2017/02/19 19:33:46
Done.
|
| +#include <sys/stat.h> |
| +#include <sys/types.h> |
| +#include <unistd.h> |
| +#endif |
| + |
| +#include <utility> |
| + |
| #include "base/memory/ptr_util.h" |
| #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| @@ -77,6 +85,12 @@ void ChromeBrowserMainExtraPartsViews::PreProfileInit() { |
| if (geteuid() != 0) |
| return; |
| + // Allow running inside an unprivileged user namespace. In that case, / |
|
Tom (Use chromium acct)
2017/02/19 19:16:06
remove / ?
Kevin Cernekee
2017/02/19 19:33:46
I changed it to "the root directory" to make the c
|
| + // will be owned by an unmapped UID and GID. |
| + struct stat st; |
| + if (stat("/", &st) == 0 && st.st_uid != 0) |
| + return; |
| + |
| const base::CommandLine& command_line = |
| *base::CommandLine::ForCurrentProcess(); |
| if (command_line.HasSwitch(switches::kNoSandbox)) |