1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00

save_textarea_file(): h -> fd, file -> fp. Idea by Alexey Tourbin.

This commit is contained in:
Laurent MONIN 2007-03-05 21:41:17 +01:00 committed by Laurent MONIN
parent 5acb3a68fb
commit 12ec62810b

View File

@ -532,18 +532,18 @@ static unsigned char *
save_textarea_file(unsigned char *value) save_textarea_file(unsigned char *value)
{ {
unsigned char *filename; unsigned char *filename;
FILE *file = NULL; FILE *fp = NULL;
int h; int fd;
filename = get_tempdir_filename("elinks-area-XXXXXX"); filename = get_tempdir_filename("elinks-area-XXXXXX");
if (!filename) return NULL; if (!filename) return NULL;
h = safe_mkstemp(filename); fd = safe_mkstemp(filename);
if (h >= 0) file = fdopen(h, "w"); if (fd >= 0) fp = fdopen(fd, "w");
if (file) { if (fp) {
fwrite(value, strlen(value), 1, file); fwrite(value, strlen(value), 1, fp);
fclose(file); fclose(fp);
} else { } else {
mem_free(filename); mem_free(filename);
} }