d5d1f7c498
From: SILC CVS
29 lines
807 B
Plaintext
29 lines
807 B
Plaintext
$OpenBSD: patch-apps_silcd_silcd_c,v 1.2 2005/09/13 02:38:52 brad Exp $
|
|
--- apps/silcd/silcd.c.orig Tue May 10 09:22:52 2005
|
|
+++ apps/silcd/silcd.c Mon Sep 12 14:09:54 2005
|
|
@@ -261,13 +261,21 @@ SILC_TASK_CALLBACK(stop_server)
|
|
SILC_TASK_CALLBACK(dump_stats)
|
|
{
|
|
FILE *fdd;
|
|
+ int fild;
|
|
char filename[256];
|
|
|
|
memset(filename, 0, sizeof(filename));
|
|
- snprintf(filename, sizeof(filename) - 1, "/tmp/silcd.%d.stats", getpid());
|
|
- fdd = fopen(filename, "w+");
|
|
- if (!fdd)
|
|
+ snprintf(filename, sizeof(filename) - 1, "/tmp/silcd.%d.stats-XXXXXX", getpid());
|
|
+ fild = mkstemp(filename);
|
|
+ if (fild == -1)
|
|
return;
|
|
+
|
|
+ fdd = fdopen(fild, "w");
|
|
+ if (fdd == NULL) {
|
|
+ close(fild);
|
|
+ unlink(filename);
|
|
+ return;
|
|
+ }
|
|
|
|
#define STAT_OUTPUT(fmt, stat) fprintf(fdd, fmt "\n", (int)stat);
|
|
|