openbsd-ports/editors/vim/patches/patch-ae
2000-01-31 05:41:53 +00:00

42 lines
1.1 KiB
Plaintext

--- ctags/entry.c.orig Tue Sep 28 20:20:25 1999
+++ ctags/entry.c Sat Jan 29 01:13:55 2000
@@ -397,6 +397,7 @@
extern void openTagFile()
{
static char tempName[L_tmpnam];
+ int tmp_fd;
setDefaultTagFileName();
TagsToStdout = isDestinationStdout();
@@ -408,8 +409,10 @@
*/
if (TagsToStdout)
{
- TagFile.name = tmpnam(tempName);
- TagFile.fp = fopen(TagFile.name, "w");
+ strcpy(tempName, "/var/tmp/ctags-XXXXXXXXXX");
+ tmp_fd = mkstemp(tempName);
+ if ((TagFile.fp = fdopen(tmp_fd, "w")) == NULL)
+ close(tmp_fd);
}
else
{
@@ -564,10 +567,14 @@
extern void beginEtagsFile()
{
- tmpnam(TagFile.etags.name);
- TagFile.etags.fp = fopen(TagFile.etags.name, "w+b");
- if (TagFile.etags.fp == NULL)
+ int tmp_fd;
+ strcpy(TagFile.etags.name, "/var/tmp/etags-XXXXXXXXXX");
+ tmp_fd = mkstemp(TagFile.etags.name);
+ TagFile.etags.fp = fdopen(tmp_fd, "w+b");
+ if (TagFile.etags.fp == NULL) {
+ close(tmp_fd);
error(FATAL | PERROR, "cannot open \"%s\"", TagFile.etags.name);
+ }
TagFile.etags.byteCount = 0;
}