From: David Turner <dturner@xxxxxxxxxxxxxxxx> Instead of writing warnings to stderr, write them to a log. Later, we'll probably be daemonized, so writing to stderr will be pointless. Signed-off-by: David Turner <dturner@xxxxxxxxxxxxxxxx> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- Documentation/git-index-helper.txt | 3 +++ index-helper.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/git-index-helper.txt b/Documentation/git-index-helper.txt index 228b1df..3d2c829 100644 --- a/Documentation/git-index-helper.txt +++ b/Documentation/git-index-helper.txt @@ -57,6 +57,9 @@ command. The following commands are used to control the daemon: All commands and replies are in pkt-line format. +In the event of an error, messages may be written to +$GIT_DIR/index-helper.log. + GIT --- Part of the linkgit:git[1] suite diff --git a/index-helper.c b/index-helper.c index 7cc8166..142af7a 100644 --- a/index-helper.c +++ b/index-helper.c @@ -103,7 +103,8 @@ static void share_index(struct index_state *istate, struct shm *is) if (shared_mmap_create(istate->mmap_size, &new_mmap, git_path("shm-index-%s", sha1_to_hex(istate->sha1))) < 0) { - die("Failed to create shm-index file"); + warning("Failed to create shm-index file"); + exit(1); } @@ -336,8 +337,17 @@ int main(int argc, char **argv) die("--exit-after value must be less than %d seconds", INT_MAX / 1000); + if (detach) { + FILE *fp = fopen(git_path("index-helper.log"), "a"); + if (!fp) + die("failed to open %s for writing", + git_path("index-helper.log")); + set_error_handle(fp); + } + if (detach && daemonize(&daemonized)) die_errno(_("unable to detach")); + loop(fd, idle_in_seconds); close(fd); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html