changeset 13471:0f3036e073b6

[gaim-migrate @ 15847] Use a temp file in the same directory as the target index path. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 09 Mar 2006 01:17:33 +0000
parents f5bc36ecf8d0
children 660916251ba8
files src/log.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/log.c	Thu Mar 09 00:09:26 2006 +0000
+++ b/src/log.c	Thu Mar 09 01:17:33 2006 +0000
@@ -1306,6 +1306,7 @@
 	FILE *index;
 	FILE *file;
 	GError *error;
+	char *index_template;
 	int index_fd;
 	char *index_tmp;
 	char buf[BUF_LONG];
@@ -1386,7 +1387,8 @@
 		return NULL;
 	}
 
-	if ((index_fd = g_file_open_tmp(NULL, &index_tmp, &error)) == -1) {
+	index_template = g_strdup_printf("%s.XXXXXX", pathstr);
+	if ((index_fd = g_file_open_tmp(index_template, &index_tmp, &error)) == -1) {
 		gaim_debug_error("log", "Failed to open index temp file: %s\n",
 		                 error->message);
 		g_error_free(error);
@@ -1406,6 +1408,7 @@
 			g_free(pathstr);
 		}
 	}
+	g_free(index_template);
 
 	while (fgets(buf, BUF_LONG, file)) {
 		if ((newlog = strstr(buf, "---- New C"))) {