1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Fix a bug in my patch, which caused the temporary file to be unlinked

unfairly. Thanks, Alex!

Submitted by:	Alexander Leidinger
This commit is contained in:
Mikhail Teterin 2001-08-15 22:41:46 +00:00
parent 9cf3af7dc9
commit 898e952ce9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=46300
2 changed files with 9 additions and 7 deletions

View File

@ -7,21 +7,24 @@
PORTNAME= knews
PORTVERSION= 1.0b.1
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= news
MASTER_SITES= http://www.matematik.su.se/~kjj/
MAINTAINER= ports@FreeBSD.org
LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg \
png.4:${PORTSDIR}/graphics/png
# compface:${PORTSDIR}/mail/faces
png.4:${PORTSDIR}/graphics/png \
compface:${PORTSDIR}/mail/faces
RUN_DEPENDS= newsp:${PORTSDIR}/print/mp-letter
USE_IMAKE= yes
USE_XPM= yes
MAKE_FLAGS= BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man1 \
XAPPLOADDIR=${PREFIX}/lib/X11/app-defaults -f
.if defined(MAKE_JOBS)
MAKE_ARGS+= -j${MAKE_JOBS}
.endif
MAN1= knews.1
.include <bsd.port.mk>

View File

@ -4,7 +4,7 @@ Use mkstemp instead of tmpnam. Copied from the tmpnam implementation :)
--- src/file.c Fri Jan 9 12:16:19 1998
+++ src/file.c Fri Jul 13 10:41:01 2001
@@ -187,13 +187,12 @@
@@ -187,13 +187,11 @@
int fd;
+ static unsigned long tmpcount;
+ static char buf[L_tmpnam];
@ -18,11 +18,10 @@ Use mkstemp instead of tmpnam. Copied from the tmpnam implementation :)
+ fd = mkstemp(buf);
+ if (fd < 0)
+ *name = NULL;
+ else
unlink(*name);
- unlink(*name);
- fd = open(*name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
- if (fd < 0)
- *name = NULL;
- }
-
return fd;