]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[settings] Fix setting expansion
authorMichael Brown <mcb30@ipxe.org>
Wed, 23 Mar 2011 10:08:16 +0000 (10:08 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 23 Mar 2011 10:08:16 +0000 (10:08 +0000)
Commit 5fbd020 ("[settings] Display canonical setting name in output
of "show" command") introduced a regression causing all setting
expansions (e.g. "${net0/mac}") to expand to an empty string.

Fix by returning the formatted value length from
fetchf_named_setting(), as expected by the caller.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/settings.c

index acd093f267fbe5b961ce49e62f3eca67ba77d88c..d498db69b70f53f1b037b3c264e63ef1ff291187 100644 (file)
@@ -1123,6 +1123,7 @@ int fetchf_named_setting ( const char *name,
        struct setting setting;
        struct settings *origin;
        char tmp_name[ strlen ( name ) + 1 ];
+       int len;
        int rc;
 
        /* Parse setting name */
@@ -1131,16 +1132,16 @@ int fetchf_named_setting ( const char *name,
                return rc;
 
        /* Fetch setting */
-       if ( ( rc = fetchf_setting ( settings, &setting, value_buf,
+       if ( ( len = fetchf_setting ( settings, &setting, value_buf,
                                     value_len ) ) < 0 )
-               return rc;
+               return len;
 
        /* Construct setting name */
        origin = fetch_setting_origin ( settings, &setting );
        assert ( origin != NULL );
        setting_name ( origin, &setting, name_buf, name_len );
 
-       return 0;
+       return len;
 }
 
 /******************************************************************************