diff options
Diffstat (limited to 'posix/tst-pathconf.c')
-rw-r--r-- | posix/tst-pathconf.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/posix/tst-pathconf.c b/posix/tst-pathconf.c index 949fc65428..26650f2517 100644 --- a/posix/tst-pathconf.c +++ b/posix/tst-pathconf.c @@ -1,5 +1,5 @@ /* Test that values of pathconf and fpathconf are consistent for a file. - Copyright (C) 2013-2016 Free Software Foundation, Inc. + Copyright (C) 2013-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/stat.h> static void prepare (void); @@ -41,12 +42,7 @@ prepare (void) static const char dir_name[] = "/tst-pathconf.XXXXXX"; size_t dirbuflen = test_dir_len + sizeof (dir_name); - dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("Out of memory"); - exit (1); - } + dirbuf = xmalloc (dirbuflen); snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); if (mkdtemp (dirbuf) == NULL) @@ -73,7 +69,7 @@ do_test (void) static const char *fifo_name = "some-fifo"; size_t filenamelen = strlen (dirbuf) + strlen (fifo_name) + 2; - char *filename = malloc (filenamelen); + char *filename = xmalloc (filenamelen); snprintf (filename, filenamelen, "%s/%s", dirbuf, fifo_name); @@ -166,11 +162,5 @@ out_nofifo: ret = 1; } - if (rmdir (dirbuf) != 0) - { - printf ("Could not remove directory (%s)\n", strerror (errno)); - ret = 1; - } - return ret; } |