summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2009-08-23 19:47:05 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2009-08-23 19:47:05 +0200
commit25cbe85eafc3d4155a59f4690a3b581ead14d938 (patch)
treec974de7a3435fa70bf1ea591a7d9769efe64d76c
parent9c989b58f694567e214deed700708f3ba9901270 (diff)
Fix pthread_setcancelstate/type crash
* pthread/pt-setcancelstate.c (pthread_setcancelstate): Check whether OLDSTATE is NULL before filling it. * pthread/pt-setcanceltype.c (pthread_setcanceltype): Likewise.
-rw-r--r--pthread/pt-setcancelstate.c3
-rw-r--r--pthread/pt-setcanceltype.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/pthread/pt-setcancelstate.c b/pthread/pt-setcancelstate.c
index ded58922..e2d81833 100644
--- a/pthread/pt-setcancelstate.c
+++ b/pthread/pt-setcancelstate.c
@@ -35,7 +35,8 @@ pthread_setcancelstate (int state, int *oldstate)
break;
}
- *oldstate = p->cancel_state;
+ if (oldstate)
+ *oldstate = p->cancel_state;
p->cancel_state = state;
return 0;
diff --git a/pthread/pt-setcanceltype.c b/pthread/pt-setcanceltype.c
index 9511c991..3ce4259c 100644
--- a/pthread/pt-setcanceltype.c
+++ b/pthread/pt-setcanceltype.c
@@ -35,7 +35,8 @@ pthread_setcanceltype (int type, int *oldtype)
break;
}
- *oldtype = p->cancel_type;
+ if (oldtype)
+ *oldtype = p->cancel_type;
p->cancel_type = type;
return 0;