Closed
Bug 99248
Opened 23 years ago
Closed 23 years ago
use of evil strtok function
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: drepper, Assigned: dougt)
Details
Attachments
(1 file)
2.08 KB,
patch
|
Details | Diff | Splinter Review |
xpcom/base/nsTraceMalloc.c is strtok which is not a thread-safe function. I'll
shortly attach a patch which fixes the problem in a way used elsewhere in the
project. The change to configure.in is also submitted as part of some other bug
reports so applying it might result in conflicts.
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Updated•23 years ago
|
Assignee | ||
Comment 2•23 years ago
|
||
chris, do the makefile changes look okay? I am happy with the rest of the patch.
Comment 4•23 years ago
|
||
Assignee | ||
Comment 5•23 years ago
|
||
Thanks for the bug fix. I have checked it into the trunk:
Checking in nsTraceMalloc.c;
/cvsroot/mozilla/xpcom/base/nsTraceMalloc.c,v <-- nsTraceMalloc.c
new revision: 1.25; previous revision: 1.24
done
Appartently, the patch to configure.in is already there.
Comment 6•23 years ago
|
||
So either the code is re-entrant and needs strtok_r -- in which case we need to
do better than just falling back to "evil strtok" if it's not present -- or it's
not re-entrant and the original code was just fine. (Not to mention clearer.)
Happily, it's the latter: the code in question is called in the unthreaded child
process spawned under --trace-malloc operation. There are no reentrance or
threadsafety issues. We should undo the patch, methinks.
Did anyone compile this patch before checking it in? nsnull isn't defined in
nsTraceMalloc.c, since it doesn't bring in nscore.h. I'm going to change the
use of nsnull to NULL, since that's consistent with the rest of the file.
Actually, what was checked in wasn't the original reviewed patch, but added an
|= nsnull| to the definition of |char *newstr|.
Assignee | ||
Comment 9•23 years ago
|
||
shaver, I see what you are saying - david, how about reverting this patch all
together?
Comment 10•23 years ago
|
||
As Nancy Kerrigan said: "Whyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy?"
Please revert. Don't fix what ain't broke (I'm sorry I skimmed bugmail this week).
/be
Assignee | ||
Comment 11•23 years ago
|
||
Checking in nsTraceMalloc.c;
/cvsroot/mozilla/xpcom/base/nsTraceMalloc.c,v <-- nsTraceMalloc.c
new revision: 1.27; previous revision: 1.26
done
Sorry about that. Don't know what I was thinking. I have reverted the blunder.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•