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> --- 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 f853960..e144752 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 terminated by a NUL byte. +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 6c8108f..e99109a 100644 --- a/index-helper.c +++ b/index-helper.c @@ -95,7 +95,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); } @@ -324,8 +325,17 @@ int main(int argc, char **argv) if (fd < 0) die_errno(_("could not set up index-helper socket")); + 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); -- 2.4.2.767.g62658d5-twtrsrc -- 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