Module Name: src Committed By: christos Date: Fri Nov 10 23:03:25 UTC 2023
Modified Files: src/tests/lib/libc/ssp: Makefile t_ssp.sh Added Files: src/tests/lib/libc/ssp: h_getcwd2.c Log Message: PR/57689: RVP: getcwd() not overridable with -D_FORTIFY_SOURCE To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/ssp/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/ssp/h_getcwd2.c cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/ssp/t_ssp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/libc/ssp/Makefile diff -u src/tests/lib/libc/ssp/Makefile:1.11 src/tests/lib/libc/ssp/Makefile:1.12 --- src/tests/lib/libc/ssp/Makefile:1.11 Sat Jun 3 05:09:15 2023 +++ src/tests/lib/libc/ssp/Makefile Fri Nov 10 18:03:25 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2023/06/03 09:09:15 lukem Exp $ +# $NetBSD: Makefile,v 1.12 2023/11/10 23:03:25 christos Exp $ NOMAN= # defined @@ -31,6 +31,7 @@ BINDIR= ${TESTSDIR} PROGS= h_fgets PROGS+= h_gets PROGS+= h_getcwd +PROGS+= h_getcwd2 PROGS+= h_memcpy PROGS+= h_memmove PROGS+= h_memset Index: src/tests/lib/libc/ssp/t_ssp.sh diff -u src/tests/lib/libc/ssp/t_ssp.sh:1.7 src/tests/lib/libc/ssp/t_ssp.sh:1.8 --- src/tests/lib/libc/ssp/t_ssp.sh:1.7 Sun Apr 6 15:28:59 2014 +++ src/tests/lib/libc/ssp/t_ssp.sh Fri Nov 10 18:03:25 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_ssp.sh,v 1.7 2014/04/06 19:28:59 christos Exp $ +# $NetBSD: t_ssp.sh,v 1.8 2023/11/10 23:03:25 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -284,6 +284,19 @@ getcwd_body() h_fail "$prog 1025" } +atf_test_case getcwd2 +getcwd2_head() +{ + atf_set "descr" "Checks getcwd(3) override" +} +getcwd2_body() +{ + prog="$(atf_get_srcdir)/h_getcwd2" + + atf_check -s exit:1 -o ignore \ + -e 'match:.*getcwd failed: Function not implemented$' $prog +} + atf_init_test_cases() { atf_add_test_case sprintf @@ -305,4 +318,5 @@ atf_init_test_cases() atf_add_test_case read atf_add_test_case readlink atf_add_test_case getcwd + atf_add_test_case getcwd2 } Added files: Index: src/tests/lib/libc/ssp/h_getcwd2.c diff -u /dev/null src/tests/lib/libc/ssp/h_getcwd2.c:1.1 --- /dev/null Fri Nov 10 18:03:25 2023 +++ src/tests/lib/libc/ssp/h_getcwd2.c Fri Nov 10 18:03:25 2023 @@ -0,0 +1,18 @@ +#include <err.h> +#include <errno.h> +#include <unistd.h> + +char* +getcwd(char* buf, size_t buflen) +{ + errno = ENOSYS; + return NULL; +} +int +main(void) +{ + char buf[256]; + if (getcwd(buf, sizeof buf) == NULL) + err(1, "getcwd failed"); + return 0; +}