Lines 17-24
Link Here
|
17 |
|
17 |
|
18 |
void cc_log(const char *format, ...); |
18 |
void cc_log(const char *format, ...); |
19 |
void fatal(const char *msg); |
19 |
void fatal(const char *msg); |
20 |
--- hash.c.orig Wed Sep 8 21:36:22 2004 |
20 |
--- hash.c.orig 2004-09-13 12:38:30.000000000 +0200 |
21 |
+++ hash.c Wed Sep 8 21:36:25 2004 |
21 |
+++ hash.c 2009-07-21 23:37:00.000000000 +0200 |
22 |
@@ -20,17 +20,22 @@ |
22 |
@@ -20,17 +20,22 @@ |
23 |
*/ |
23 |
*/ |
24 |
|
24 |
|
Lines 46-52
Link Here
|
46 |
} |
46 |
} |
47 |
|
47 |
|
48 |
void hash_string(const char *s) |
48 |
void hash_string(const char *s) |
49 |
@@ -46,35 +51,40 @@ |
49 |
@@ -46,35 +51,44 @@ |
50 |
/* add contents of a file to the hash */ |
50 |
/* add contents of a file to the hash */ |
51 |
void hash_file(const char *fname) |
51 |
void hash_file(const char *fname) |
52 |
{ |
52 |
{ |
Lines 72-83
Link Here
|
72 |
+ close(fd); |
72 |
+ close(fd); |
73 |
+ fatal(__FUNCTION__); |
73 |
+ fatal(__FUNCTION__); |
74 |
+ } |
74 |
+ } |
75 |
+ buf = mmap(NULL, stats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); |
75 |
+ if( stats.st_size == 0 ) |
76 |
+ if (buf == MAP_FAILED) { |
76 |
+ buf = NULL; |
77 |
+ cc_log("Failed to mmap %s\n", fname); |
77 |
+ else { |
78 |
+ close(fd); |
78 |
+ buf = mmap(NULL, stats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); |
79 |
+ fatal(__FUNCTION__); |
79 |
+ if (buf == MAP_FAILED) { |
80 |
+ } |
80 |
+ cc_log("Failed to mmap %s\n", fname); |
|
|
81 |
+ close(fd); |
82 |
+ fatal(__FUNCTION__); |
83 |
+ } |
84 |
+ } |
81 |
+ |
85 |
+ |
82 |
+ hash_buffer(buf, stats.st_size); |
86 |
+ hash_buffer(buf, stats.st_size); |
83 |
close(fd); |
87 |
close(fd); |