diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-02-14 05:12:12 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-02-14 05:12:12 +0000 |
commit | b90ca275ff6418cd59116b2bdad3228791cc4dcc (patch) | |
tree | a6133cc5145f721e3a286642d365848f36a69dbd /test/misc | |
parent | e907e7f674a68ca6804464db3de5a727a637cc2c (diff) |
get rid of link time warning with tmpname()
Diffstat (limited to 'test/misc')
-rw-r--r-- | test/misc/fdopen.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/misc/fdopen.c b/test/misc/fdopen.c index 8842d0583..91f8a5c81 100644 --- a/test/misc/fdopen.c +++ b/test/misc/fdopen.c @@ -1,6 +1,7 @@ /* Test for fdopen bugs. */ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -12,17 +13,20 @@ goto the_end; \ } -char buffer[256]; - int main (int argc, char *argv[]) { - char *name; + char name[256]; FILE *fp = NULL; int retval = 0; int fd; - name = tmpnam (NULL); + /* hack to get a tempfile name w/out using tmpname() + * as that func causes a link time warning */ + sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__); + fd = mkstemp(name); + close(fd); + fp = fopen (name, "w"); assert (fp != NULL) fputs ("foobar and baz", fp); |