pthread_create.3: Fix bug in EXAMPLE program

The bug is in this part of the code:

    /* Allocate memory for pthread_create() arguments */

    tinfo = calloc(num_threads, num_threads);
    if (tinfo == NULL)
       errExit("calloc");

The calloc() line should read like this instead:

    tinfo = calloc(num_threads, sizeof(struct thread_info));

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Karsten Weiss 2008-11-05 09:26:44 -05:00 committed by Michael Kerrisk
parent c94081aa45
commit 061f742a28
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH PTHREAD_CREATE 3 2008-10-24 "Linux" "Linux Programmer's Manual"
.TH PTHREAD_CREATE 3 2008-11-05 "Linux" "Linux Programmer's Manual"
.SH NAME
pthread_create \- create a new thread
.SH SYNOPSIS
@ -317,7 +317,7 @@ main(int argc, char *argv[])
/* Allocate memory for pthread_create() arguments */
tinfo = calloc(num_threads, num_threads);
tinfo = calloc(num_threads, sizeof(struct thread_info));
if (tinfo == NULL)
errExit("calloc");