Make the length of SingletonSocket's path as short as we can
This commit is contained in:
parent
ec832f418a
commit
0900762507
1 changed files with 15 additions and 1 deletions
|
@ -111,7 +111,7 @@ const base::FilePath::CharType kSingletonCookieFilename[] =
|
||||||
|
|
||||||
const base::FilePath::CharType kSingletonLockFilename[] = FILE_PATH_LITERAL("SingletonLock");
|
const base::FilePath::CharType kSingletonLockFilename[] = FILE_PATH_LITERAL("SingletonLock");
|
||||||
const base::FilePath::CharType kSingletonSocketFilename[] =
|
const base::FilePath::CharType kSingletonSocketFilename[] =
|
||||||
FILE_PATH_LITERAL("SingletonSocket");
|
FILE_PATH_LITERAL("SS");
|
||||||
|
|
||||||
// Set the close-on-exec bit on a file descriptor.
|
// Set the close-on-exec bit on a file descriptor.
|
||||||
// Returns 0 on success, -1 on failure.
|
// Returns 0 on success, -1 on failure.
|
||||||
|
@ -943,6 +943,19 @@ bool ProcessSingleton::Create() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MAS_BUILD)
|
||||||
|
// For Mac App Store build, the tmp dir could be too long to fit
|
||||||
|
// addr->sun_path, so we need to make it as short as possible.
|
||||||
|
base::FilePath tmp_dir;
|
||||||
|
if (!base::GetTempDir(&tmp_dir)) {
|
||||||
|
LOG(ERROR) << "Failed to get temporary directory.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!socket_dir_.Set(tmp_dir.Append("S"))) {
|
||||||
|
LOG(ERROR) << "Failed to set socket directory.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
// Create the socket file somewhere in /tmp which is usually mounted as a
|
// Create the socket file somewhere in /tmp which is usually mounted as a
|
||||||
// normal filesystem. Some network filesystems (notably AFS) are screwy and
|
// normal filesystem. Some network filesystems (notably AFS) are screwy and
|
||||||
// do not support Unix domain sockets.
|
// do not support Unix domain sockets.
|
||||||
|
@ -950,6 +963,7 @@ bool ProcessSingleton::Create() {
|
||||||
LOG(ERROR) << "Failed to create socket directory.";
|
LOG(ERROR) << "Failed to create socket directory.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check that the directory was created with the correct permissions.
|
// Check that the directory was created with the correct permissions.
|
||||||
int dir_mode = 0;
|
int dir_mode = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue