[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH 2/7] system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set
From:       Steffen Prohaska <prohaska () zib ! de>
Date:       2008-08-18 5:28:56
Message-ID: 6E4B0DFF-DD1D-450D-B02A-9A89E260DBCB () zib ! de
[Download RAW message or body]


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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic