Date: Mon, 21 Oct 1996 10:32:21 -0400 From: Garrett Wollman <wollman@lcs.mit.edu> To: Ron Bolin <rlb@mindspring.com> Cc: freebsd-current@FreeBSD.org Subject: mktemp BUG? Message-ID: <9610211432.AA13540@halloran-eldar.lcs.mit.edu> In-Reply-To: <326AD788.167EB0E7@mindspring.com> References: <326AD788.167EB0E7@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Sun, 20 Oct 1996 21:53:12 -0400, Ron Bolin <rlb@mindspring.com> said: > Just checking my system and sanity. The mktemp(char *) function > dumps core everytime. Seems to be a problem in the C lib version. > Can anyone else duplicate this bug? > #include <stdlib.h> > char *tmp = mktemp("/tmp/cp.XXXXXX"); Your code is erroneous. You cannot overwrite a string literal. #include <stdlib.h> void foo(void) { static char path[] = "/tmp/cp.XXXXXX"; if (mktemp(path)) { /* do something with it */ } } -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, ANA, or NSA| - Susan Aglukark and Chad Irschick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9610211432.AA13540>