Changeset 140922 in webkit
- Timestamp:
- Jan 26, 2013, 5:36:36 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r140921 r140922 1 2013-01-26 Sam Weinig <sam@webkit.org> 2 3 Simplify environment creation in XPC service re-exec 4 https://bugs.webkit.org/show_bug.cgi?id=108017 5 6 Reviewed by Dan Bernstein. 7 8 * Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h: 9 (WebKit::XPCServiceEventHandler): 10 There is no need to copy these strings. 11 1 12 2013-01-26 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceBootstrapper.Development.h
r140920 r140922 97 97 size_t numberOfEnvironmentVariables = xpc_array_get_count(environmentArray); 98 98 99 char** environment = (char**)malloc(numberOfEnvironmentVariables * sizeof(char*) + 1); 100 for (size_t i = 0; i < numberOfEnvironmentVariables; ++i) { 101 const char* string = xpc_array_get_string(environmentArray, i); 102 size_t stringLength = strlen(string); 103 104 char* environmentVariable = (char*)malloc(stringLength + 1); 105 memcpy(environmentVariable, string, stringLength); 106 environmentVariable[stringLength] = '\0'; 107 108 environment[i] = environmentVariable; 109 } 99 const char** environment = (const char**)malloc(numberOfEnvironmentVariables * sizeof(char*) + 1); 100 for (size_t i = 0; i < numberOfEnvironmentVariables; ++i) 101 environment[i] = xpc_array_get_string(environmentArray, i); 110 102 environment[numberOfEnvironmentVariables] = 0; 111 103 112 104 pid_t processIdentifier = 0; 113 posix_spawn(&processIdentifier, path, 0, &attr, const_cast<char**>(args), environment);105 posix_spawn(&processIdentifier, path, 0, &attr, const_cast<char**>(args), const_cast<char**>(environment)); 114 106 115 107 posix_spawnattr_destroy(&attr);
Note:
See TracChangeset
for help on using the changeset viewer.