* Bug in pthread_setcancelstate()?
@ 1999-10-28 9:40 Erik Hensema
0 siblings, 0 replies; only message in thread
From: Erik Hensema @ 1999-10-28 9:40 UTC (permalink / raw)
To: 'Pthreads-win32'
Hi,
From the pthread_setcancelstate() from SunOS 5.5.1:
pthread_setcancelstate
pthread_setcancelstate() automically sets the calling
thread's cancellation state to the specified state and, if
oldstate is not NULL, stores the previous cancellation state
in oldstate.
In cancel.c:
if (((self = pthread_self ()) != NULL) &&
(state == PTHREAD_CANCEL_ENABLE ||
state == PTHREAD_CANCEL_DISABLE))
{
*oldstate = self->cancelState; <---- crash if oldstate==NULL
self->cancelState = state;
result = 0;
}
As you can see, it will crash if oldstate==NULL.
The obvious fix is to add the line " if(oldstate!=NULL)" above the
"*oldstate=".
ps. I haven't checked this with the Posix standard, so it can also be a
deviation from the standard by Sun; however, I think the code is more robust
this way.
--
Erik Hensema
Work: erik.hensema@group2000.nl
Home: erik@hensema.xs4all.nl
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-10-28 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-28 9:40 Bug in pthread_setcancelstate()? Erik Hensema
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).