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 /src/regress/lib/libc/getexecpath/getexecpath.c | |
| parent | daea0693c19acb492f94b5a2d2b6217e7ce9c124 (diff) | |
| download | openbsd-master.tar.gz openbsd-master.tar.bz2 openbsd-master.zip | |
Diffstat (limited to 'src/regress/lib/libc/getexecpath/getexecpath.c')
| -rw-r--r-- | src/regress/lib/libc/getexecpath/getexecpath.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 | } | ||
