cvs commit: ALFS/nALFS/src handlers.c

Jamie Bennett jamie_bennett at pcpmicro.co.uk
Wed Feb 4 00:37:30 PST 2004


Kevin P. Fleming wrote on 04 February 2004 01:35
> jamie at linuxfromscratch.org wrote:
> 
>>   +char *alloc_base_dir_force(element_s *el)
> 
> You know, this brings to mind something that I wanted to do before...
> Every handler that exists in standard nALFS uses the same technique of
> allocating a copy of the base directory path, chdir()-ing to it, then
> freeing the copy. I don't think any of them do anything else useful with
> that copy.
> 
> How about instead of alloc_base_dir_force instead we have
> chdir_base_dir_force, and it takes care of the whole thing? No extra
> copy of the string needs to be made, and testing the chdir() result can
> be done inside the function as well.

Agreed again but ... 

At the moment alloc_base_dir_new(element_s *el) (which most handlers use
now) 
always allocates a base dir even when a base isn't specified (returns '/' if

no base is found. Thats why I made alloc_base_dir_force so it could error on

no <base>. Should we return an error when no base is specified? or return
'/'?

...
Jamie Bennett	-	jamie at linuxfromscratch dot org



More information about the alfs-log mailing list