diff options
author | Roland McGrath <roland@gnu.org> | 2005-10-17 09:05:20 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2005-10-17 09:05:20 +0000 |
commit | ca74ce53fd609a626d877a66956fdc3470953c8f (patch) | |
tree | d5ce5b427cb156830d4a7ebdd1678608cb73c37f | |
parent | 632e09c574a98502bff33da73b3a9aeebd7637f4 (diff) | |
download | glibc-ca74ce53fd609a626d877a66956fdc3470953c8f.tar.gz glibc-ca74ce53fd609a626d877a66956fdc3470953c8f.tar.xz glibc-ca74ce53fd609a626d877a66956fdc3470953c8f.zip |
2005-07-24 Ulrich Drepper <drepper@redhat.com>
[BZ #1125] * posix/Makefile (tests): Add tst-execvp4. * posix/tst-execvp4.c: New file.
-rw-r--r-- | posix/Makefile | 2 | ||||
-rw-r--r-- | posix/tst-execvp4.c | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/posix/Makefile b/posix/Makefile index 6bccab9831..a048831416 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -87,7 +87,7 @@ tests := tstgetopt testfnm runtests runptests \ tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \ - tst-execvp3 + tst-execvp3 tst-execvp4 xtests := bug-ga2 ifeq (yes,$(build-shared)) test-srcs := globtest diff --git a/posix/tst-execvp4.c b/posix/tst-execvp4.c new file mode 100644 index 0000000000..531fab227b --- /dev/null +++ b/posix/tst-execvp4.c @@ -0,0 +1,35 @@ +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/stat.h> + +static int +do_test (void) +{ + char buf[40] = "/usr/bin/does-not-exist"; + size_t stemlen = strlen (buf); + struct stat64 st; + int cnt = 0; + while (stat64 (buf, &st) != -1 || errno != ENOENT + || stat64 (buf + 4, &st) != -1 || errno != ENOENT) + { + if (cnt++ == 100) + { + puts ("cannot find a unique file name"); + return 0; + } + + strcpy (buf + stemlen, ".XXXXXX"); + mktemp (buf); + } + + unsetenv ("PATH"); + char *argv[] = { buf + 9, NULL }; + execvp (argv[0], argv); + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |