From: Steffen Prohaska Date: Mon, 18 Aug 2008 05:28:56 GMT Subject: Re: [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set Message-ID: <6E4B0DFF-DD1D-450D-B02A-9A89E260DBCB@zib.de> In-Reply-To: <200808172243.09129.johannes.sixt@telecom.at> On Aug 17, 2008, at 10:43 PM, Johannes Sixt wrote: > On Sonntag, 17. August 2008, Steffen Prohaska wrote: >> >> diff --git a/exec_cmd.c b/exec_cmd.c >> index ce6741e..1622481 100644 >> --- a/exec_cmd.c >> +++ b/exec_cmd.c >> @@ -9,11 +9,51 @@ static const char *argv0_path; >> >> const char *system_path(const char *path) >> { >> - if (!is_absolute_path(path) && argv0_path) { >> - struct strbuf d = STRBUF_INIT; >> - strbuf_addf(&d, "%s/%s", argv0_path, path); >> - path = strbuf_detach(&d, NULL); >> +#ifdef RUNTIME_PREFIX >> + static const char *prefix; >> + >> + if (!argv0_path) { >> + fprintf(stderr, "RUNTIME_PREFIX requested for path '%s', " >> + "but argv0_path not set.\n", path); > > If this happens, isn't this a logic error: assert(argv0_path)? We could consider this a logic error. >> } >> + >> + if (!prefix) { >> + fprintf(stderr, "RUNTIME_PREFIX requested for path '%s', " >> + "but prefix computation failed.\n", path); > > Again a logic error? The user can move the executable, so it's not a logic error. Steffen