summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Balneaves <[email protected]>2013-05-07 20:24:00 -0500
committerScott Balneaves <[email protected]>2013-05-07 20:24:00 -0500
commitd92c2754681b24ed5afcbb0d9458297e6101254e (patch)
tree6f96e5c9ecd0d72efd8b28a499db846fc71b6f23
parentd116bf8ba8be698869fef81b30d576bcacf3234c (diff)
downloadcaja-d92c2754681b24ed5afcbb0d9458297e6101254e.tar.bz2
caja-d92c2754681b24ed5afcbb0d9458297e6101254e.tar.xz
Fix for #111
-rw-r--r--libcaja-private/caja-file.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 6c252e3b..84d799f9 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -7149,7 +7149,7 @@ caja_file_is_binary (CajaFile *file)
gboolean is_binary = FALSE;
int c;
- int i;
+ int i = 0;
FILE *fp;
/* Check the first 4096 bytes of the files. If these contains a 0,
@@ -7162,15 +7162,17 @@ caja_file_is_binary (CajaFile *file)
{
return FALSE;
}
- for (i = 0; i < 4096; i++) {
- c = fgetc(fp);
- if (c == EOF) {
+
+ while (!feof (fp)) {
+ if (i > 4096) {
break;
}
- else if (c == 0) {
+ c = fgetc(fp);
+ if (c == 0) {
is_binary = TRUE;
break;
}
+ i++;
}
fclose(fp);