diff options
| author | deraadt <> | 2026-08-31 15:17:53 +0000 |
|---|---|---|
| committer | deraadt <> | 2026-08-31 15:17:53 +0000 |
| commit | b8f8f8a555b51a55550edea2b563ad914ef4da5c (patch) | |
| tree | 46bc2840a88794872a032a9eb8fd115b331fb085 | |
| parent | daea0693c19acb492f94b5a2d2b6217e7ce9c124 (diff) | |
| download | openbsd-b8f8f8a555b51a55550edea2b563ad914ef4da5c.tar.gz openbsd-b8f8f8a555b51a55550edea2b563ad914ef4da5c.tar.bz2 openbsd-b8f8f8a555b51a55550edea2b563ad914ef4da5c.zip | |
| -rw-r--r-- | src/regress/lib/libc/Makefile | 4 | ||||
| -rw-r--r-- | src/regress/lib/libc/getexecpath/Makefile | 8 | ||||
| -rw-r--r-- | src/regress/lib/libc/getexecpath/getexecpath.c | 24 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile index 555b826e96..c43cb5aa6c 100644 --- a/src/regress/lib/libc/Makefile +++ b/src/regress/lib/libc/Makefile | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.64 2026/06/27 17:52:29 jca Exp $ | 1 | # $OpenBSD: Makefile,v 1.65 2026/08/31 15:17:51 deraadt Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR+= _setjmp | 3 | SUBDIR+= _setjmp |
| 4 | SUBDIR+= alloca arc4random-fork atexit | 4 | SUBDIR+= alloca arc4random-fork atexit |
| 5 | SUBDIR+= basename | 5 | SUBDIR+= basename |
| 6 | SUBDIR+= cephes cxa-atexit | 6 | SUBDIR+= cephes cxa-atexit |
| 7 | SUBDIR+= db dirname | 7 | SUBDIR+= db dirname |
| 8 | SUBDIR+= elf_aux_info | 8 | SUBDIR+= elf_aux_info getexecpath |
| 9 | SUBDIR+= env explicit_bzero | 9 | SUBDIR+= env explicit_bzero |
| 10 | SUBDIR+= ffs fmemopen fnmatch fpclassify fread freeaddrinfo | 10 | SUBDIR+= ffs fmemopen fnmatch fpclassify fread freeaddrinfo |
| 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob | 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob |
diff --git a/src/regress/lib/libc/getexecpath/Makefile b/src/regress/lib/libc/getexecpath/Makefile new file mode 100644 index 0000000000..c952c5cb38 --- /dev/null +++ b/src/regress/lib/libc/getexecpath/Makefile | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | PROG=getexecpath | ||
| 2 | |||
| 3 | WARNINGS=yes | ||
| 4 | |||
| 5 | run-regress-${PROG}: ${PROG} | ||
| 6 | ./${PROG} `cd ${.OBJDIR} && pwd -P`/${PROG} | ||
| 7 | |||
| 8 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/getexecpath/getexecpath.c b/src/regress/lib/libc/getexecpath/getexecpath.c new file mode 100644 index 0000000000..c0ee005ca2 --- /dev/null +++ b/src/regress/lib/libc/getexecpath/getexecpath.c | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #include <sys/types.h> | ||
| 2 | #include <sys/auxv.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <string.h> | ||
| 5 | #include <unistd.h> | ||
| 6 | #include <limits.h> | ||
| 7 | #include <stdio.h> | ||
| 8 | #include <err.h> | ||
| 9 | |||
| 10 | int | ||
| 11 | main(int argc, char *argv[]) | ||
| 12 | { | ||
| 13 | char path[PATH_MAX]; | ||
| 14 | |||
| 15 | if (argc < 1) | ||
| 16 | errx(1, "usage: getexecpath expected-path"); | ||
| 17 | |||
| 18 | if (getexecpath(path, sizeof path) == -1) | ||
| 19 | err(1, "getexepath: on path"); | ||
| 20 | if (strcmp(path, argv[1]) != 0) | ||
| 21 | exit(1); | ||
| 22 | printf("getexecpath(3) is working\n"); | ||
| 23 | exit(0); | ||
| 24 | } | ||
