33 lines
843 B
Plaintext
33 lines
843 B
Plaintext
$OpenBSD: patch-src_file_export_c,v 1.5 2009/03/06 20:44:24 ckuethe Exp $
|
|
--- src/file_export.c.orig Sat Jan 17 22:52:32 2009
|
|
+++ src/file_export.c Thu Feb 26 23:12:07 2009
|
|
@@ -42,6 +42,7 @@
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
+#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
@@ -100,8 +101,11 @@ static gboolean
|
|
copy_file_fd_sync (FILE *from, FILE *to)
|
|
{
|
|
gboolean result = FALSE;
|
|
- gchar data[READ_WRITE_BLOCKSIZE];
|
|
+ char *data;
|
|
|
|
+ if ((data = malloc(READ_WRITE_BLOCKSIZE)) == NULL)
|
|
+ return FALSE;
|
|
+
|
|
if((from) && (to))
|
|
{
|
|
int read_bytes = 0, write_bytes = 0;
|
|
@@ -138,6 +142,7 @@ copy_file_fd_sync (FILE *from, FILE *to)
|
|
|
|
} while(!(feof(from)));
|
|
}
|
|
+ free(data);
|
|
if (!result)
|
|
result = fsync (fileno (to));
|
|
return(result);
|