Context: Add more uniqueness to temp directory names.
- If a single thread attempted to establish multiple package kit contexts, it would fail due to a collision between their respective temporary directories. As such, use both the thread ID and system_time() as a random elements in the directory name to ensure this doesn't occur.
This commit is contained in:
parent
da33beab70
commit
93cb796e37
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2011-2013, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -94,7 +94,8 @@ BContext::_Initialize()
|
||||
if ((result = tempDirectory.InitCheck()) != B_OK)
|
||||
return result;
|
||||
|
||||
BString contextName = BString("pkgkit-context-") << find_thread(NULL);
|
||||
BString contextName = BString("pkgkit-context-") << find_thread(NULL)
|
||||
<< "-" << system_time();
|
||||
BDirectory baseDirectory;
|
||||
result = tempDirectory.CreateDirectory(contextName.String(),
|
||||
&baseDirectory);
|
||||
|
Loading…
Reference in New Issue
Block a user