[hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl

On 17.04.2012 18:16, Xin wrote:
On 19/03/12 16:59, Diego Biurrun wrote:
>     review needs-fixing
>
>
>>  --- lib/core/hostid.c 2012-03-01 14:26:43 +0000
>>  +++ lib/core/hostid.c 2012-03-15 08:58:36 +0000
>>  @@ -678,6 +679,7 @@
>>         int                      dsa_pub_key_rr_len = 0, rsa_pub_key_rr_len 
= 0;
>>         hip_hdr                  numeric_action     = 0;
>>  +    char                    *hi_file_dup        = NULL;
>>         char                     hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
>>  @@ -743,11 +745,16 @@
>>                     goto out_err;
>>                 }
>>             } else if (!use_default) {
>>  +            hi_file_dup = strdup(hi_file);
>>  +            if ((err = check_and_create_dir(dirname(hi_file_dup), 
HIP_DIR_MODE))) {
>>  +                HIP_ERROR("Could not create direcory for path: %s\n", 
hi_file);
>>  +                goto out_err;
>  You strup - why?
the function dirname() might modify the parameter, so I copy it.


This is ok now, but tucking the strdup() and dirname() away into check_and_create_dir() could be less distracting and reusable. I'm not sure.

Other related posts: