This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11655] qsort() not thread safe, results to division by zero
- From: "naohiro.ooiwa at miraclelinux dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Thu, 9 Dec 2010 05:31:49 +0000
- Subject: [Bug libc/11655] qsort() not thread safe, results to division by zero
- Auto-submitted: auto-generated
- References: <bug-11655-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=11655
--- Comment #1 from Naohiro Ooiwa <naohiro.ooiwa at miraclelinux dot com> 2010-12-09 05:31:34 UTC ---
Created attachment 5152
--> http://sourceware.org/bugzilla/attachment.cgi?id=5152
qsort_r-for-thread-safety.patch
The same problem occurs in my environment too.
I tried to create a patch and
I attached the same patch file as following.
Is my patch reasonable?
Could you please check the my patch ?
Thanks in advance,
diff --git a/stdlib/msort.c b/stdlib/msort.c
index 35cd4d0..2cc2abc 100644
--- a/stdlib/msort.c
+++ b/stdlib/msort.c
@@ -182,7 +182,7 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp,
void *arg)
static long int phys_pages;
static int pagesize;
- if (phys_pages == 0)
+ if (phys_pages == 0 || pagesize == 0)
{
phys_pages = __sysconf (_SC_PHYS_PAGES);
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.