From: Tim Hollebeek <tim@wagner.Princeton.EDU>
To: egcs@cygnus.com
Subject: Re: tmpnam() core dumping
Date: Fri, 12 Dec 1997 15:46:00 -0000 [thread overview]
Message-ID: <199712122335.SAA24029@franck.Princeton.EDU> (raw)
In-Reply-To: <01BD06E5.D34DA340@bill.icdata.com>
Bill Ahlbrandt writes ...
>
> Yes, using -fwritable-strings fixes the problem.
>
> I wonder why these functions want to modify the string that is passed to them :-)?
Normal behavior. Otherwise they would have to call malloc() to allocate the
result, or something similar. E.g. from the IRIX man page:
tmpnam always generates a file name using the path-prefix defined as
P_tmpdir in the <stdio.h> header file. If s is NULL, tmpnam leaves its
result in an internal static area and returns a pointer to that area.
The next call to tmpnam will destroy the contents of the area. If s is
not NULL, it is assumed to be the address of an array of at least
L_tmpnam bytes, where L_tmpnam is a constant defined in <stdio.h>; tmpnam
places its result in that array and returns s.
---------------------------------------------------------------------------
Tim Hollebeek | "Everything above is a true
email: tim@wfn-shop.princeton.edu | statement, for sufficiently
URL: http://wfn-shop.princeton.edu/~tim | false values of true."
next prev parent reply other threads:[~1997-12-12 15:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-12 10:18 Bill Ahlbrandt
1997-12-12 13:04 ` Per Bothner
1997-12-12 14:32 ` [EGCS] " Marc Lehmann
1997-12-12 15:46 ` Tim Hollebeek [this message]
1997-12-15 2:51 ` Andreas Schwab
-- strict thread matches above, loose matches on Subject: below --
1997-12-15 8:20 Bill Ahlbrandt
1997-12-13 9:55 Bill Ahlbrandt
1997-12-12 6:18 Bill Ahlbrandt
1997-12-12 8:02 ` Jeffrey A Law
1997-12-12 14:32 ` Marc Lehmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199712122335.SAA24029@franck.Princeton.EDU \
--to=tim@wagner.princeton.edu \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).