From 9e81bcae18567540d5cf689f826a7291d48cb877 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 20 Feb 2004 19:33:43 +0000 Subject: [PATCH] * Removed our customized tmpnam() and tmpfile() because I stupidly hardcoded /tmp into them. --- citadel/citadel.h | 9 --------- citadel/citmail.c | 8 +------- citadel/tools.c | 32 -------------------------------- 3 files changed, 1 insertion(+), 48 deletions(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index e2565f4dc..d0d961d99 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -324,14 +324,5 @@ enum { } #endif -#ifdef tmpnam -#undef tmpnam -#endif -#define tmpnam(x) CtdlTempFileName(__FILE__, __LINE__) - -#ifdef tmpfile -#undef tmpfile -#endif -#define tmpfile() CtdlTempFile() #endif /* CITADEL_H */ diff --git a/citadel/citmail.c b/citadel/citmail.c index bebbb998b..d657e9e88 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -170,17 +170,11 @@ void cleanup(int exitcode) { int main(int argc, char **argv) { char buf[1024]; char fromline[1024]; - char tempfilename[SIZ]; FILE *fp; get_config(); - sprintf(tempfilename, "/tmp/citmail.%04x.%04x", - (int)time(NULL), - (int)getpid() - ); - fp = fopen(tempfilename, "w+b"); - unlink(tempfilename); + fp = tmpfile(); if (fp == NULL) return(errno); snprintf(fromline, sizeof fromline, "From: someone@somewhere.org"); while (fgets(buf, 1024, stdin) != NULL) { diff --git a/citadel/tools.c b/citadel/tools.c index c82128df7..17fcb225d 100644 --- a/citadel/tools.c +++ b/citadel/tools.c @@ -546,38 +546,6 @@ void urlesc(char *outbuf, char *strbuf) } -/* - * Citadelian replacement for tmpnam() - */ -char *CtdlTempFileName(char *prefix1, int prefix2) { - static int seq = 0; - static char buf[SIZ]; - - sprintf(buf, "/tmp/Citadel-%s-%d-%04x-%04x", - prefix1, - prefix2, - (int)getpid(), - ++seq - ); - - return(buf); -} - - -/* - * Citadelian replacement for tmpfile() - */ -FILE *CtdlTempFile(void) { - char filename[SIZ]; - FILE *fp; - - strcpy(filename, tmpnam(NULL)); - fp = fopen(filename, "w+b"); - unlink(filename); - return(fp); -} - - /* * bmstrstr() is a variant of strstr() that uses the Boyer-Moore search * algorithm, and can use any caller-supplied string compare function whose -- 2.39.2