summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormpp <mpp@FreeBSD.org>1996-02-15 05:02:16 +0000
committermpp <mpp@FreeBSD.org>1996-02-15 05:02:16 +0000
commit548ad36a132025c41ad4c095084ee9e822e281ef (patch)
tree926f15cb7b6c86984a232b49d679c0a1bd2cbb7f /lib
parent654abf9871924629d6433a0b06434e5aaac3cbbc (diff)
downloadFreeBSD-src-548ad36a132025c41ad4c095084ee9e822e281ef.zip
FreeBSD-src-548ad36a132025c41ad4c095084ee9e822e281ef.tar.gz
Added a little NOTES section explaining that passing in a string that
resides in read-only memory is going to cause the program to core dump, and this is commmon with older pre-ANSI C programs. (I've scratched my head over this one at 3 in the morning before while trying to port some ancient program) Suggested by: Gary Kline <kline@tera.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/mktemp.322
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libc/stdio/mktemp.3 b/lib/libc/stdio/mktemp.3
index 361bebf..a9d3146 100644
--- a/lib/libc/stdio/mktemp.3
+++ b/lib/libc/stdio/mktemp.3
@@ -124,6 +124,28 @@ may also set
to any value specified by the
.Xr open 2
function.
+.Sh NOTES
+A common problem that results in a core dump is that the programmer
+passes in a read-only string to
+.Fn mktemp
+or
+.Fn mkstemp .
+This is common with programs that were developed before
+.St -ansiC
+compilers were common..
+For example, calling
+.Fn mkstemp
+with an argument of
+.Qq /tmp/tempfile.XXXXXX
+will result in a core dump due to
+.Fn mkstemp
+attempting to modify the string constant that was given.
+If the program in question makes heavy use of that type
+of function call, you do have the option of compiling the program
+so that it will store string constants in a writable segment of memory.
+See
+.Xr gcc 1
+for more information.
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr getpid 2 ,
OpenPOWER on IntegriCloud