From 93cdcca9ba4018c094c558418a120928f2ab32ee Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 2 Mar 2004 15:38:20 +0000 Subject: [PATCH] When we try to create a temporary file and it already exists (which can happen if a program with the same PID has crashed at some time in the past), don't panic and rewrite the file. Should be safe since we're using our own tmp directory nobody else can access. --- lib/fb-temp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fb-temp.c b/lib/fb-temp.c index bdaf831d..a537dd93 100644 --- a/lib/fb-temp.c +++ b/lib/fb-temp.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- Temporary Fastbufs * - * (c) 2002 Martin Mares + * (c) 2002--2004 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -35,7 +35,7 @@ bopen_tmp(uns bufsize) static uns temp_counter; sprintf(buf, temp_template, (int) getpid(), temp_counter++); - f = bopen(buf, O_RDWR | O_CREAT | O_EXCL, bufsize); + f = bopen(buf, O_RDWR | O_CREAT | O_TRUNC, bufsize); bconfig(f, BCONFIG_IS_TEMP_FILE, 1); return f; } -- 2.39.2