From: mquinson Date: Tue, 3 Jul 2007 15:34:10 +0000 (+0000) Subject: Make sure that MSG_process_get_PID() never raise an exception, even with invalid... X-Git-Tag: v3.3~1712 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/39c6a42ab89e515e5be6f68c11cd3ba98b85cb47 Make sure that MSG_process_get_PID() never raise an exception, even with invalid parameters, because it will be called back by the exception handling mecanism (through the logs), and it will lead to a stack overflow git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3648 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/msg/m_process.c b/src/msg/m_process.c index f318b223f0..c3b04d11d3 100644 --- a/src/msg/m_process.c +++ b/src/msg/m_process.c @@ -234,7 +234,10 @@ m_process_t MSG_process_from_PID(int PID) */ int MSG_process_get_PID(m_process_t process) { - xbt_assert0(((process != NULL) && (process->simdata)), "Invalid parameters"); + /* Do not raise an exception here: this function is used in the logs, + and it will be called back by the exception handling stuff */ + if (process == NULL || process->simdata == NULL) + return -1; return (((simdata_process_t) process->simdata)->PID); }