Subject: lib/31383: Documentative omission in mktemp.3
To: None <email@example.com, firstname.lastname@example.org,>
From: None <email@example.com>
Date: 09/24/2005 00:04:00
>Synopsis: Documentative omission in mktemp.3
>Arrival-Date: Sat Sep 24 00:04:00 +0000 2005
>Originator: Tonnerre Lombard
There is an implementation detail about mktemp() and gcc which causes a segmentation fault if one uses mktemp() in the seemingly most obvious way. The problem is created by the two facts that
1. mktemp() takes a string as an argument, but it actually writes to that string
2. gcc puts static strings into the readonly section
It's not properly documented yet that mktemp("/tmp/blubb-XXXXXX"); is going to cause a segfault for attempting to write to readonly memory. While this may be obvious to us, there have been some people who considered this a bug.
The solution, I think, is to document this behavior properly.
int fd = mkstemp("/tmp/blubb-XXXXXX");
http://users.thundrix.ch/~tonnerre/system/netbsd/mktemp-doc-fix.diff , maybe with properly changed wording or something