57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
--- ctags/entry.c.orig Tue Sep 28 20:20:25 1999
|
|
+++ ctags/entry.c Wed Feb 2 09:37:07 2000
|
|
@@ -397,6 +397,9 @@
|
|
extern void openTagFile()
|
|
{
|
|
static char tempName[L_tmpnam];
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ int tmp_fd;
|
|
+#endif
|
|
|
|
setDefaultTagFileName();
|
|
TagsToStdout = isDestinationStdout();
|
|
@@ -408,8 +411,15 @@
|
|
*/
|
|
if (TagsToStdout)
|
|
{
|
|
- TagFile.name = tmpnam(tempName);
|
|
- TagFile.fp = fopen(TagFile.name, "w");
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ strcpy(tempName, "/var/tmp/ctags-XXXXXXXXXX");
|
|
+ tmp_fd = mkstemp(tempName);
|
|
+ if ((TagFile.fp = fdopen(tmp_fd, "w")) == NULL)
|
|
+ close(tmp_fd);
|
|
+#else
|
|
+ TagFile.name = tmpnam(tempName);
|
|
+ TagFile.fp = fopen(TagFile.name, "w");
|
|
+#endif
|
|
}
|
|
else
|
|
{
|
|
@@ -564,10 +574,21 @@
|
|
|
|
extern void beginEtagsFile()
|
|
{
|
|
- tmpnam(TagFile.etags.name);
|
|
- TagFile.etags.fp = fopen(TagFile.etags.name, "w+b");
|
|
- if (TagFile.etags.fp == NULL)
|
|
- error(FATAL | PERROR, "cannot open \"%s\"", TagFile.etags.name);
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ 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);
|
|
+ }
|
|
+#else
|
|
+ tmpnam(TagFile.etags.name);
|
|
+ TagFile.etags.fp = fopen(TagFile.etags.name, "w+b");
|
|
+ if (TagFile.etags.fp == NULL)
|
|
+ error(FATAL | PERROR, "cannot open \"%s\"", TagFile.etags.name);
|
|
+#endif
|
|
TagFile.etags.byteCount = 0;
|
|
}
|
|
|