Summary: | For DARWIN platforms, use system temporary directory for DataLog output | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Michael Saboff <msaboff> | ||||||
Component: | JavaScriptCore | Assignee: | Michael Saboff <msaboff> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | benjamin, cmarcelo, commit-queue | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Michael Saboff
2014-04-29 11:22:09 PDT
Created attachment 230393 [details]
Work in Progress
Created attachment 230395 [details]
Patch
Comment on attachment 230395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230395&action=review > Source/WTF/ChangeLog:8 > + Added code to call confstr() to access the process' temporary directory to use that "process's" -- there's only one. > Source/WTF/wtf/DataLog.cpp:84 > + size_t lastComponentLength = strlen(logBasename) + 10; > + size_t dirnameLength = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, 1024); > + if ((dirnameLength + lastComponentLength + 10) < maxPathLength) { > + strncat(filenameBuffer, logBasename, maxPathLength - dirnameLength); > + filename = filenameBuffer; > + } Why + 10? > Source/WTF/wtf/DataLog.cpp:106 > if (!file) > - fprintf(stderr, "Warning: Could not open log file %s for writing.\n", actualFilename); > + WTFLogAlways("Warning: Could not open log file %s for writing.\n", actualFilename); > +#if DATA_LOG_TO_DARWIN_TEMP_DIR > + else > + WTFLogAlways("*** Logging to \"%s\" ***\n", actualFilename); > +#endif Better to say "if (file) / else" rather than "if (!file) / else". Comment on attachment 230395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230395&action=review >> Source/WTF/ChangeLog:8 >> + Added code to call confstr() to access the process' temporary directory to use that > > "process's" -- there's only one. "process'" is a valid possessive form of process. >> Source/WTF/wtf/DataLog.cpp:84 >> + } > > Why + 10? For the .<pid>.txt, with an up to 5 digit pid, added below. I'll recode without the constant. >> Source/WTF/wtf/DataLog.cpp:106 >> +#endif > > Better to say "if (file) / else" rather than "if (!file) / else". I'll make the change. Committed r167953: <http://trac.webkit.org/changeset/167953> |