Joe Ciccone wrote:

> char *tempbase;
> int main (int argc, char **argv)
> {
>   char wtmp[] = "txidxXXXXXX";
>   tempbase = mktemp (wtmp);
>   return 0;
> }
> 
> the program above doesnt segfault.
> information was from:
> http://lists.debian.org/debian-user/1999/10/msg02102.html
> "Using the brackets ("[]") here forces the allocation of an array big
> 
> enough to hold the initializer value ("/tmp/tmpfileXXXXXX" with trailing
> NUL character).  With the "char *" you're only allocating a pointer and
> telling it to point to a string constant (which is in read-only memory)."

Good spot.  It looks like our patch to texinfo to "fix" the mktemp issue
may need a patch!  I'll take a look at changing it.

  -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to