diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-04 21:28:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-04 21:28:14 +0000 |
commit | 36ccadb98b92786dc65af4294851ed538d7166e5 (patch) | |
tree | 77b282c3d2b378c878265974c46531c03c98fdf6 | |
parent | 40bf5d27b21fedc867bd9f6bd001697bd1077ba1 (diff) | |
download | gnunet-gtk-36ccadb98b92786dc65af4294851ed538d7166e5.tar.gz gnunet-gtk-36ccadb98b92786dc65af4294851ed538d7166e5.zip |
-do not try to mmap empty file
-rw-r--r-- | src/fs/gnunet-fs-gtk_common.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c index 90077f52..a987b25a 100644 --- a/src/fs/gnunet-fs-gtk_common.c +++ b/src/fs/gnunet-fs-gtk_common.c | |||
@@ -210,6 +210,11 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename, | |||
210 | GNUNET_break (0); | 210 | GNUNET_break (0); |
211 | return GNUNET_SYSERR; | 211 | return GNUNET_SYSERR; |
212 | } | 212 | } |
213 | if (0 == fsize) | ||
214 | { | ||
215 | /* empty file, cannot be a directory */ | ||
216 | return GNUNET_SYSERR; | ||
217 | } | ||
213 | if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, | 218 | if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, |
214 | GNUNET_DISK_PERM_NONE))) | 219 | GNUNET_DISK_PERM_NONE))) |
215 | { | 220 | { |