From 038c784a7807d6b2b2bb9ed940c534ba48dd7248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= Date: Wed, 26 Dec 2018 01:01:14 +0100 Subject: [PATCH 1/2] readlink test: inverse return code We need to return 0 in case readlink is *broken* here - this is because our waf CHECK_CODE function does only allow generating defines in case the test succeeds BUG: https://bugzilla.samba.org/show_bug.cgi?id=13631 Signed-off-by: Bjoern Jacke Reviewed-by: Jeremy Allison (cherry picked from commit e225ab70db0cc01454d319eaca5265d7e33f396c) --- tests/readlink.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/readlink.c b/tests/readlink.c index 65311c2ff79..a09eba4af2b 100644 --- a/tests/readlink.c +++ b/tests/readlink.c @@ -1,4 +1,7 @@ -/* test whether readlink returns a short buffer correctly. */ +/* test whether readlink returns a short buffer incorrectly. + We need to return 0 in case readlink is *broken* here - this is because our waf + CHECK_CODE function does only allow generating defines in case the test succeeds +*/ #if defined(HAVE_UNISTD_H) #include @@ -20,14 +23,14 @@ int main(void) unlink(FNAME); ret = symlink(DATA, FNAME); if (ret == -1) { - exit(1); + exit(0); } rl_ret = readlink(FNAME, buf, sizeof(buf)); if (rl_ret == -1) { unlink(FNAME); - exit(1); + exit(0); } unlink(FNAME); - exit(0); + exit(1); } -- 2.20.2 From 37758de5fbc4dd9ae09fbae120d8a8a2e3ebd107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= Date: Wed, 26 Dec 2018 01:03:29 +0100 Subject: [PATCH 2/2] waf: re-add missing readlink test this was another portability regression that came with the moving to waf BUG: https://bugzilla.samba.org/show_bug.cgi?id=13631 Signed-off-by: Bjoern Jacke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Feb 18 23:12:51 UTC 2022 on sn-devel-184 (cherry picked from commit 45cb14ac80889ac913f7f76dbfaebcb4d5ee14fd) --- source3/wscript | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/wscript b/source3/wscript index c28aff1a68c..acdbfaf1215 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1389,6 +1389,12 @@ main() { addmain=False, execute=True) + conf.CHECK_CODE('''#include "../tests/readlink.c"''', + 'HAVE_BROKEN_READLINK', + msg='Checking for readlink breakage', + addmain=False, + execute=True) + conf.SET_TARGET_TYPE('sendfile', 'EMPTY') conf.CHECK_LIB('sendfile') if not Options.options.with_sendfile_support == False: -- 2.20.2