aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2009-06-11 15:12:27 -0400
committerMichael Brown <mcb30@etherboot.org>2009-06-13 12:04:08 +0100
commit68973f1c491060cbe4c559467dd103866b04129d (patch)
treeca21109d64a0ef27d5267e1263f3b863e73efa80 /src
parentedfbd4e4fa63ded7df7232d38cfeb16bc5662f6d (diff)
downloadipxe-68973f1c491060cbe4c559467dd103866b04129d.zip
ipxe-68973f1c491060cbe4c559467dd103866b04129d.tar.gz
ipxe-68973f1c491060cbe4c559467dd103866b04129d.tar.bz2
[settings] Fix setting_cmp() to handle nameless settings
setting_cmp() compares by option tag and then by name. Empty names will always match, which gives us a false positive. Fix by explicitly checking for empty names. Modified-by: Michael Brown <mcb30@etherboot.org> Signed-off-by: Michael Brown <mcb30@etherboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/settings.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 7a02985..87d84a0 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -782,8 +782,12 @@ int setting_cmp ( struct setting *a, struct setting *b ) {
if ( a->tag && ( a->tag == b->tag ) )
return 0;
- /* Otherwise, compare the names */
- return strcmp ( a->name, b->name );
+ /* Otherwise, if the settings have names, compare them */
+ if ( a->name && b->name && a->name[0] )
+ return strcmp ( a->name, b->name );
+
+ /* Otherwise, return a non-match */
+ return ( ! 0 );
}
/******************************************************************************