Re: [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set
On Aug 17, 2008, at 10:43 PM, Johannes Sixt wrote:
Show 22 quoted lines
> 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.
Show 7 quoted lines
>> }
>> +
>> + 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