mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 04:20:17 +03:00
[Settings] show_setting() functions return snprintf()-style length.
show_setting() and related functions now return an "actual length" in the style of snprintf(). This is to allow consumers to allocate buffers large enough to hold the formatted setting.
This commit is contained in:
@@ -28,7 +28,7 @@ static int show_exec ( int argc, char **argv ) {
|
||||
|
||||
dummy_context.options = ugly_nvo_hack->options;
|
||||
if ( ( rc = show_named_setting ( &dummy_context, argv[1], buf,
|
||||
sizeof ( buf ) ) ) != 0 ) {
|
||||
sizeof ( buf ) ) ) < 0 ) {
|
||||
printf ( "Could not find \"%s\": %s\n",
|
||||
argv[1], strerror ( -rc ) );
|
||||
return 1;
|
||||
|
||||
@@ -118,7 +118,7 @@ static void load_setting ( struct setting_widget *widget ) {
|
||||
|
||||
/* Read current setting value */
|
||||
if ( show_setting ( widget->context, widget->setting,
|
||||
widget->value, sizeof ( widget->value ) ) != 0 ) {
|
||||
widget->value, sizeof ( widget->value ) ) < 0 ) {
|
||||
widget->value[0] = '\0';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user