Преглед на файлове

[settings] Fix setting expansion

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>
tags/v1.20.1
Michael Brown преди 13 години
родител
ревизия
b36882be34
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4
    3
      src/core/settings.c

+ 4
- 3
src/core/settings.c Целия файл

@@ -1123,6 +1123,7 @@ int fetchf_named_setting ( const char *name,
1123 1123
 	struct setting setting;
1124 1124
 	struct settings *origin;
1125 1125
 	char tmp_name[ strlen ( name ) + 1 ];
1126
+	int len;
1126 1127
 	int rc;
1127 1128
 
1128 1129
 	/* Parse setting name */
@@ -1131,16 +1132,16 @@ int fetchf_named_setting ( const char *name,
1131 1132
 		return rc;
1132 1133
 
1133 1134
 	/* Fetch setting */
1134
-	if ( ( rc = fetchf_setting ( settings, &setting, value_buf,
1135
+	if ( ( len = fetchf_setting ( settings, &setting, value_buf,
1135 1136
 				     value_len ) ) < 0 )
1136
-		return rc;
1137
+		return len;
1137 1138
 
1138 1139
 	/* Construct setting name */
1139 1140
 	origin = fetch_setting_origin ( settings, &setting );
1140 1141
 	assert ( origin != NULL );
1141 1142
 	setting_name ( origin, &setting, name_buf, name_len );
1142 1143
 
1143
-	return 0;
1144
+	return len;
1144 1145
 }
1145 1146
 
1146 1147
 /******************************************************************************

Loading…
Отказ
Запис