Actually do the mmap... unsurprisingly, this makes the indexer work on SFS On RAM: the .idx and .pack files become links to a .lock and the original download respectively. Assume some feature (such as record locking) supported by SFS but not JXFS or RAM: is required.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/src/indexer.c b/src/indexer.c
index f0e0a63..5542bfe 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -363,11 +363,11 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if (error < 0) {
idx->off = entry_start;
error = store_delta(idx);
+
if (error == GIT_EBUFS)
return 0;
if (error < 0)
return error;
-
continue;
}
diff --git a/src/mwindow.c b/src/mwindow.c
index 57adabd..74fbf78 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -158,6 +158,7 @@ static git_mwindow *new_window(
git_mwindow *w;
w = git__malloc(sizeof(*w));
+
if (w == NULL)
return NULL;
diff --git a/src/pack.c b/src/pack.c
index 85bc670..9b5e0e1 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -215,7 +215,7 @@ static int packfile_unpack_header1(
unsigned shift;
unsigned long size, c;
unsigned long used = 0;
-printf("[pack 218] buf = %lx, used = %ld, len = %ld\n", buf, used, len);
+
c = buf[used++];
*type = (c >> 4) & 7;
size = c & 15;
@@ -261,8 +261,8 @@ int git_packfile_unpack_header(
base = git_mwindow_open(mwf, w_curs, *curpos, 20, &left);
if (base == NULL)
return GIT_EBUFS;
-printf("[pack 264] base = %lx, mwf = %lx\n", base, mwf);
- ret = packfile_unpack_header1(&used, size_p, type_p, base, left);
+
+ ret = packfile_unpack_header1(&used, size_p, type_p, base, left);
git_mwindow_close(w_curs);
if (ret == GIT_EBUFS)
return ret;
diff --git a/src/unix/map.c b/src/unix/map.c
index 8e853b9..b04e95a 100644
--- a/src/unix/map.c
+++ b/src/unix/map.c
@@ -39,11 +39,11 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
#else
if ((prot & GIT_PROT_WRITE) && ((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED)) {
printf("Trying to map shared-writeable file!!!\n");
+ }
- if(out->data = malloc(len)) {
- lseek(fd, offset, SEEK_SET);
- p_read(fd, out->data, len);
- }
+ if(out->data = malloc(len)) {
+ lseek(fd, offset, SEEK_SET);
+ p_read(fd, out->data, len);
}
#endif