summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorAaron Young2019-01-09 20:35:39 +0100
committerMichael Brown2019-01-15 15:12:27 +0100
commit3946aa9bac1b4a784924fab1693bfebfdd357438 (patch)
treef3d76d225d0f7b16ad5a530c511a125714683bb7 /src/tests
parent[efi] Fix error handling path in efi_snp_probe (diff)
downloadipxe-3946aa9bac1b4a784924fab1693bfebfdd357438.tar.gz
ipxe-3946aa9bac1b4a784924fab1693bfebfdd357438.tar.xz
ipxe-3946aa9bac1b4a784924fab1693bfebfdd357438.zip
[libc] Fix strcmp()/strncmp() to return proper values
Fix strcmp() and strncmp() to return proper standard positive/negative values for unequal strings. Current implementation is backwards (i.e. the functions are returning negative when should be positive and vice-versa). Currently all consumers of these functions only check the return value for ==0 or !=0 and so we can safely change the implementation without breaking things. Signed-off-by: Aaron Young <Aaron.Young@oracle.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/string_test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tests/string_test.c b/src/tests/string_test.c
index 4693b5f6..a66501da 100644
--- a/src/tests/string_test.c
+++ b/src/tests/string_test.c
@@ -88,6 +88,7 @@ static void string_test_exec ( void ) {
ok ( strcmp ( "Hello", "hello" ) != 0 );
ok ( strcmp ( "Hello", "Hello world!" ) != 0 );
ok ( strcmp ( "Hello world!", "Hello" ) != 0 );
+ ok ( strcmp ( "abc", "def" ) < 0 );
/* Test strncmp() */
ok ( strncmp ( "", "", 0 ) == 0 );