From owner-freebsd-current Mon Oct 21 07:34:56 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA15638 for current-outgoing; Mon, 21 Oct 1996 07:34:56 -0700 (PDT) Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id HAA15629 for ; Mon, 21 Oct 1996 07:34:49 -0700 (PDT) Received: by halloran-eldar.lcs.mit.edu; (5.65v3.2/1.1.8.2/19Aug95-0530PM) id AA13540; Mon, 21 Oct 1996 10:32:21 -0400 Date: Mon, 21 Oct 1996 10:32:21 -0400 From: Garrett Wollman Message-Id: <9610211432.AA13540@halloran-eldar.lcs.mit.edu> To: Ron Bolin Cc: freebsd-current@FreeBSD.org Subject: mktemp BUG? In-Reply-To: <326AD788.167EB0E7@mindspring.com> References: <326AD788.167EB0E7@mindspring.com> Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk < 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 > char *tmp = mktemp("/tmp/cp.XXXXXX"); Your code is erroneous. You cannot overwrite a string literal. #include 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