| Index: chrome/browser/chromeos/gdata/gdata_file_system.cc
|
| diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
|
| index dd2ed256ae88be849e6c3baca1d3dc83fc6ca550..a8c7dc21ebe9f21879bc51324b1f04e10422f771 100644
|
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
|
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
|
|
|
| #include <errno.h>
|
| +#include <sys/stat.h>
|
|
|
| #include <utility>
|
|
|
| @@ -204,6 +205,22 @@ base::PlatformFileError CreateCacheDirectories(
|
| return error;
|
| }
|
|
|
| +// Changes the permissions of |file_path| to |permissions|.
|
| +// Returns the platform error code of the operation.
|
| +base::PlatformFileError ChangeFilePermissions(const FilePath& file_path,
|
| + mode_t permissions) {
|
| + base::PlatformFileError error = base::PLATFORM_FILE_OK;
|
| +
|
| + if (HANDLE_EINTR(chmod(file_path.value().c_str(), permissions)) != 0) {
|
| + error = SystemToPlatformError(errno);
|
| + PLOG(ERROR) << "Error changing permissions of " << file_path.value();
|
| + } else {
|
| + DVLOG(1) << "Changed permissions of " << file_path.value();
|
| + }
|
| +
|
| + return error;
|
| +}
|
| +
|
| // Modifies cache state of file on IO thread pool, which involves:
|
| // - moving or copying file (per |file_operation_type|) from |source_path| to
|
| // |dest_path| if they're different
|
| @@ -3249,7 +3266,14 @@ void GDataFileSystem::InitializeCacheIfNecessary() {
|
|
|
| void GDataFileSystem::InitializeCacheOnIOThreadPool() {
|
| base::PlatformFileError error = CreateCacheDirectories(cache_paths_);
|
| + if (error != base::PLATFORM_FILE_OK)
|
| + return;
|
|
|
| + // Change permissions of cache persistent directory to u+rwx,og+x in order to
|
| + // allow archive files in that directory to be mounted by cros-disks.
|
| + error = ChangeFilePermissions(
|
| + cache_paths_[GDataRootDirectory::CACHE_TYPE_PERSISTENT],
|
| + S_IRWXU | S_IXGRP | S_IXOTH);
|
| if (error != base::PLATFORM_FILE_OK)
|
| return;
|
|
|
|
|