From: Julian Seward Date: Mon, 9 May 2011 22:42:06 +0000 (+0000) Subject: VG_(mkstemp): fix infinite loop in the case where /tmp isn't X-Git-Tag: svn/VALGRIND_3_7_0~500 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c797d22c857998c0244da3b4502b7776f5b44695;p=thirdparty%2Fvalgrind.git VG_(mkstemp): fix infinite loop in the case where /tmp isn't writable. Fixes #223249. (Florian Krohm, britzel@acm.org) git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11737 --- diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 2b9e44547c..05ae152aad 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -641,7 +641,7 @@ Int VG_(mkstemp) ( HChar* part_of_name, /*OUT*/HChar* fullname ) tries = 0; while (True) { - if (tries > 10) + if (tries++ > 10) return -1; VG_(sprintf)( buf, "/tmp/valgrind_%s_%08x", part_of_name, VG_(random)( &seed ));