summaryrefslogtreecommitdiff
path: root/lib/replace/tests
AgeCommit message (Collapse)AuthorFilesLines
2025-11-11lib:replace: Add test for memset_explicit()Douglas Bagnall1-0/+99
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-05-28Fix clang 20 format-truncation warningsGary Lockyer1-0/+6
Fix: lib/replace/tests/testsuite.c:387:6: error: 'snprintf' will always be truncated; specified size is 3, but format string expands to at least 5 [-Werror,-Wformat-truncation] 387 | if (snprintf(tmp, 3, "foo%d", 9) != 4) { | ^ As this is an explicit test of snprintf's truncation behaviour the warning can be safely suppressed. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-01-02remove usage of bzeroMichael Tokarev1-7/+0
bzero() function has been deprecated for a long time. In samba it is replaced with memset(). But samba also provides common memory-zeroing macros, like ZERO_STRUCT(). In all places where bzero() is used, it actually meant to zero a structure or an array. So replace these bzero() calls with ZERO_STRUCT() or ZERO_ARRAY() as appropriate, and remove bzero() replacement and testing entirely. While at it, also stop checking for presence of memset() - this function is standard for a very long time, and the only conditional where HAVE_MEMSET were used, was to provide replacement for bzero() - in all other places memset() is used unconditionally. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2023-10-13lib:replace: Properly check result of write() and read() (CID 1034925)Joseph Sutton1-2/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-02-01lib:replace: Fix NULL issue reported by covscanPavel Filipenský1-1/+1
Found by covscan. Coding style kept as in the rest of the file. Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Feb 1 21:09:21 UTC 2022 on sn-devel-184
2022-02-01lib:replace: Fix trailing whitespace in os2_delete.cPavel Filipenský1-2/+2
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-08-16testsuite: Fix build with gcc >= 11.1.1Andreas Schneider1-1/+5
Pair-Programmed-With: Jeremy Allison <jra@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Aug 16 17:20:37 UTC 2021 on sn-devel-184
2021-08-16lib:replace: Remove trailing spaces from testsuite.cAndreas Schneider1-5/+5
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-05-07lib:replace: Do not build strndup test with gcc 11 or newerAndreas Schneider1-0/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14699 gcc11 with -O3 detects that the size is incorrect: lib/replace/tests/testsuite.c:286:13: error: ‘strndup’ specified bound 10 exceeds source size 4 [-Werror=stringop-overread] 286 | x = strndup("bla", 10); | ^~~~~~~~~~~~~~~~~~ Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-04-27lib:replace: Fix a posible double freeAndreas Schneider1-1/+0
CID 1477397 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Apr 27 17:51:36 UTC 2021 on sn-devel-184
2021-04-25lib:replace: Fix possible resource leaks in test_closefrom()Andreas Schneider1-0/+2
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sun Apr 25 22:02:20 UTC 2021 on sn-devel-184
2021-04-25lib:replace: Fix memory leak in test_asprintf()Andreas Schneider1-1/+7
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-04-25lib:replace: Fix a memleak in test_strndup()Andreas Schneider1-6/+14
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-04-25lib:replace: Fix a memleak in test_strdup()Andreas Schneider1-1/+6
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-04-25lib:replace: Fix resource leak in os2_delete testAndreas Schneider1-0/+1
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-03-26lib: Add macro ARRAY_DEL_ELEMENT()Volker Lendecke1-0/+42
Every time I have to remove an element from within an array I have to scratch my head about the memmove arguments. Make this easier to use. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-10-04lib/replace: Remove libaio supportVolker Lendecke1-1/+0
io_uring is the way to go these days, libaio was never really useful for Samba Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 4 18:18:41 UTC 2019 on sn-devel-184
2019-05-06replace: Fix "make test" to actually test libreplaceAndrew Bartlett9-0/+1832
Found by Joe Guo during preperation for automated code coverage output. In order to allow the Makefile wrapper to work we need to rename the test directory to tests. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>