Return to BSD News archive
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!think.com!ames!decwrl!concert!duke!khera
From: khera@cs.duke.edu (Vivek Khera)
Newsgroups: comp.unix.bsd
Subject: Re: mktemp - Bus Error.
Message-ID: <KHERA.92Nov3111245@thneed.cs.duke.edu>
Date: 3 Nov 92 16:12:45 GMT
References: <6607@otc.otca.oz> <1992Nov2.210351.12723@ee.ryerson.ca>
<1992Nov2.215333.1434@Princeton.EDU>
Sender: news@duke.cs.duke.edu
Organization: Duke University CS Dept., Durham, NC
Lines: 24
Nntp-Posting-Host: thneed.cs.duke.edu
In-reply-to: jsm@beam.Princeton.EDU's message of 2 Nov 92 21:53:33 GMT
X-Md4-Signature: e9fdb1249054ffdc694c1e8a998717c7
In article <1992Nov2.215333.1434@Princeton.EDU> jsm@beam.Princeton.EDU (John Scott McCauley Jr.) writes:
You might need to specify '-fwritable-strings' if you are using GCC
or try something like:
char tempname[1024];
....
strcpy(tempname, "/tmp/foo.XXXXXX");
mktemp(tempname);
you don't need something so complicated. how about this:
char tmpname[] = "/tmp/foo.XXXXXX";
mktemp(tempname);
since the declaration of tmpname will make the string be stored in
writable space. note that
char *tmpname = "/tmp/foo.XXXXXX";
will cause the string to be stored in non-writable space.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Gradual Student/Systems Guy Department of Computer Science
Internet: khera@cs.duke.edu Box 90129
(MIME mail accepted) Durham, NC 27708-0129 (919)660-6528