fix mkstemp() patch.
From: SILC CVS
This commit is contained in:
parent
6431192afb
commit
d5d1f7c498
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.25 2005/09/09 20:08:54 brad Exp $
|
||||
# $OpenBSD: Makefile,v 1.26 2005/09/13 02:38:52 brad Exp $
|
||||
|
||||
COMMENT= "Secure Internet Live Conferencing (SILC) server"
|
||||
|
||||
DISTNAME= silc-server-1.0
|
||||
PKGNAME= ${DISTNAME}p4
|
||||
PKGNAME= ${DISTNAME}p5
|
||||
CATEGORIES= net
|
||||
|
||||
HOMEPAGE= http://www.silcnet.org/
|
||||
|
@ -1,7 +1,11 @@
|
||||
$OpenBSD: patch-apps_silcd_silcd_c,v 1.1 2005/09/05 16:12:50 brad Exp $
|
||||
--- apps/silcd/silcd.c.orig Mon Sep 5 10:38:25 2005
|
||||
+++ apps/silcd/silcd.c Mon Sep 5 11:07:06 2005
|
||||
@@ -264,9 +264,9 @@ SILC_TASK_CALLBACK(dump_stats)
|
||||
$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));
|
||||
@ -9,8 +13,16 @@ $OpenBSD: patch-apps_silcd_silcd_c,v 1.1 2005/09/05 16:12:50 brad Exp $
|
||||
- fdd = fopen(filename, "w+");
|
||||
- if (!fdd)
|
||||
+ snprintf(filename, sizeof(filename) - 1, "/tmp/silcd.%d.stats-XXXXXX", getpid());
|
||||
+ fdd = mkstemp(filename);
|
||||
+ if (fdd == -1)
|
||||
+ 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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user