2016-06-11 Paul Pluzhnikov <ppluzhnikov@google.com>

[BZ #19670]
	[BZ #19672]

	* io/test-lfs.c (do_prepare): Use xmalloc.
	* io/tst-fcntl.c (do_prepare): Likewise.
	* libio/tst-fopenloc.c (do_bz17916): Likewise.
	* libio/tst-mmap2-eofsync.c (do_prepare): Likewise.
	* posix/tst-exec.c (do_prepare): Likewise.
	* posix/tst-pathconf.c (prepare): Likewise.
	* posix/tst-spawn.c (do_prepare): Likewise.
	* posix/tst-truncate.c (do_prepare): Likewise.
	* rt/tst-aio.c (do_prepare): Likewise.
This commit is contained in:
Paul Pluzhnikov 2016-06-11 14:50:16 -07:00
parent b7a9b7b05b
commit 850c67606e
11 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,18 @@
2016-06-11 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #19670]
[BZ #19672]
* io/test-lfs.c (do_prepare): Use xmalloc.
* io/tst-fcntl.c (do_prepare): Likewise.
* libio/tst-fopenloc.c (do_bz17916): Likewise.
* libio/tst-mmap2-eofsync.c (do_prepare): Likewise.
* posix/tst-exec.c (do_prepare): Likewise.
* posix/tst-pathconf.c (prepare): Likewise.
* posix/tst-spawn.c (do_prepare): Likewise.
* posix/tst-truncate.c (do_prepare): Likewise.
* rt/tst-aio.c (do_prepare): Likewise.
2016-06-11 Florian Weimer <fweimer@redhat.com> 2016-06-11 Florian Weimer <fweimer@redhat.com>
[BZ #20237] [BZ #20237]
@ -214,7 +229,7 @@
new entries in auto-propagate mode. new entries in auto-propagate mode.
* nscd/grpcache.c (cache_addgr): Likewise. * nscd/grpcache.c (cache_addgr): Likewise.
2016-06-09 Paul Pluzhnikov <ppluzhnikov@gmail.com> 2016-06-09 Paul Pluzhnikov <ppluzhnikov@google.com>
* test-skeleton.c (oom_error, xmalloc, xcalloc, xrealloc): * test-skeleton.c (oom_error, xmalloc, xcalloc, xrealloc):
New functions. New functions.

View File

@ -53,7 +53,7 @@ do_prepare (int argc, char *argv[])
struct rlimit64 rlim; struct rlimit64 rlim;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name = malloc (name_len + sizeof ("/lfsXXXXXX")); name = xmalloc (name_len + sizeof ("/lfsXXXXXX"));
mempcpy (mempcpy (name, test_dir, name_len), mempcpy (mempcpy (name, test_dir, name_len),
"/lfsXXXXXX", sizeof ("/lfsXXXXXX")); "/lfsXXXXXX", sizeof ("/lfsXXXXXX"));

View File

@ -47,7 +47,7 @@ do_prepare (int argc, char *argv[])
size_t name_len; size_t name_len;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name = malloc (name_len + sizeof ("/fcntlXXXXXX")); name = xmalloc (name_len + sizeof ("/fcntlXXXXXX"));
mempcpy (mempcpy (name, test_dir, name_len), mempcpy (mempcpy (name, test_dir, name_len),
"/fcntlXXXXXX", sizeof ("/fcntlXXXXXX")); "/fcntlXXXXXX", sizeof ("/fcntlXXXXXX"));
/* Create the temporary file. */ /* Create the temporary file. */

View File

@ -26,9 +26,13 @@
#include <wchar.h> #include <wchar.h>
#include <sys/resource.h> #include <sys/resource.h>
static const char inputfile[] = "../iconvdata/testdata/ISO-8859-1"; static const char inputfile[] = "../iconvdata/testdata/ISO-8859-1";
static int do_test(void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int static int
do_bz17916 (void) do_bz17916 (void)
{ {
@ -39,7 +43,7 @@ do_bz17916 (void)
setrlimit (RLIMIT_STACK, &rl); setrlimit (RLIMIT_STACK, &rl);
const size_t sz = 2 * 1024 * 1024; const size_t sz = 2 * 1024 * 1024;
char *ccs = malloc (sz); char *ccs = xmalloc (sz);
strcpy (ccs, "r,ccs="); strcpy (ccs, "r,ccs=");
memset (ccs + 6, 'A', sz - 6 - 1); memset (ccs + 6, 'A', sz - 6 - 1);
ccs[sz - 1] = '\0'; ccs[sz - 1] = '\0';
@ -85,6 +89,3 @@ do_test (void)
return do_bz17916 (); return do_bz17916 ();
} }
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

View File

@ -20,7 +20,7 @@ static char *pages;
static void static void
do_prepare (void) do_prepare (void)
{ {
pages = malloc (getpagesize () * 2); pages = xmalloc (getpagesize () * 2);
memset (pages, 'a', getpagesize ()); memset (pages, 'a', getpagesize ());
memset (pages + getpagesize (), 'b', getpagesize ()); memset (pages + getpagesize (), 'b', getpagesize ());

View File

@ -62,7 +62,7 @@ do_prepare (int argc, char *argv[])
size_t name_len; size_t name_len;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name = malloc (name_len + sizeof ("/utmpXXXXXX")); name = xmalloc (name_len + sizeof ("/utmpXXXXXX"));
mempcpy (mempcpy (name, test_dir, name_len), mempcpy (mempcpy (name, test_dir, name_len),
"/utmpXXXXXX", sizeof ("/utmpXXXXXX")); "/utmpXXXXXX", sizeof ("/utmpXXXXXX"));

View File

@ -59,12 +59,12 @@ do_prepare (int argc, char *argv[])
size_t name_len; size_t name_len;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name1 = malloc (name_len + sizeof ("/execXXXXXX")); name1 = xmalloc (name_len + sizeof ("/execXXXXXX"));
mempcpy (mempcpy (name1, test_dir, name_len), mempcpy (mempcpy (name1, test_dir, name_len),
"/execXXXXXX", sizeof ("/execXXXXXX")); "/execXXXXXX", sizeof ("/execXXXXXX"));
add_temp_file (name1); add_temp_file (name1);
name2 = malloc (name_len + sizeof ("/execXXXXXX")); name2 = xmalloc (name_len + sizeof ("/execXXXXXX"));
mempcpy (mempcpy (name2, test_dir, name_len), mempcpy (mempcpy (name2, test_dir, name_len),
"/execXXXXXX", sizeof ("/execXXXXXX")); "/execXXXXXX", sizeof ("/execXXXXXX"));
add_temp_file (name2); add_temp_file (name2);

View File

@ -41,12 +41,7 @@ prepare (void)
static const char dir_name[] = "/tst-pathconf.XXXXXX"; static const char dir_name[] = "/tst-pathconf.XXXXXX";
size_t dirbuflen = test_dir_len + sizeof (dir_name); size_t dirbuflen = test_dir_len + sizeof (dir_name);
dirbuf = malloc (dirbuflen); dirbuf = xmalloc (dirbuflen);
if (dirbuf == NULL)
{
puts ("Out of memory");
exit (1);
}
snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
if (mkdtemp (dirbuf) == NULL) if (mkdtemp (dirbuf) == NULL)
@ -73,7 +68,7 @@ do_test (void)
static const char *fifo_name = "some-fifo"; static const char *fifo_name = "some-fifo";
size_t filenamelen = strlen (dirbuf) + strlen (fifo_name) + 2; 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); snprintf (filename, filenamelen, "%s/%s", dirbuf, fifo_name);

View File

@ -63,17 +63,17 @@ do_prepare (int argc, char *argv[])
size_t name_len; size_t name_len;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name1 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); name1 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX"));
mempcpy (mempcpy (name1, test_dir, name_len), mempcpy (mempcpy (name1, test_dir, name_len),
"/spawnXXXXXX", sizeof ("/spawnXXXXXX")); "/spawnXXXXXX", sizeof ("/spawnXXXXXX"));
add_temp_file (name1); add_temp_file (name1);
name2 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); name2 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX"));
mempcpy (mempcpy (name2, test_dir, name_len), mempcpy (mempcpy (name2, test_dir, name_len),
"/spawnXXXXXX", sizeof ("/spawnXXXXXX")); "/spawnXXXXXX", sizeof ("/spawnXXXXXX"));
add_temp_file (name2); add_temp_file (name2);
name3 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); name3 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX"));
mempcpy (mempcpy (name3, test_dir, name_len), mempcpy (mempcpy (name3, test_dir, name_len),
"/spawnXXXXXX", sizeof ("/spawnXXXXXX")); "/spawnXXXXXX", sizeof ("/spawnXXXXXX"));
add_temp_file (name3); add_temp_file (name3);

View File

@ -59,7 +59,7 @@ do_prepare (int argc, char *argv[])
#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX" #define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
name_len = strlen (test_dir); name_len = strlen (test_dir);
name = malloc (name_len + sizeof (FNAME)); name = xmalloc (name_len + sizeof (FNAME));
mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME)); mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
add_temp_file (name); add_temp_file (name);

View File

@ -51,7 +51,7 @@ do_prepare (int argc, char *argv[])
size_t name_len; size_t name_len;
name_len = strlen (test_dir); name_len = strlen (test_dir);
name = malloc (name_len + sizeof ("/aioXXXXXX")); name = xmalloc (name_len + sizeof ("/aioXXXXXX"));
mempcpy (mempcpy (name, test_dir, name_len), mempcpy (mempcpy (name, test_dir, name_len),
"/aioXXXXXX", sizeof ("/aioXXXXXX")); "/aioXXXXXX", sizeof ("/aioXXXXXX"));