Index: uspace/lib/posix/stdlib.c
===================================================================
--- uspace/lib/posix/stdlib.c	(revision 087c87980bf17015f89d56dc5abfb18a9c54e33b)
+++ uspace/lib/posix/stdlib.c	(revision 102a729e88b697a95ed9ce5fbcd3097ac1b9b456)
@@ -40,4 +40,5 @@
 
 #include "errno.h"
+#include "limits.h"
 
 #include "libc/sort.h"
@@ -138,5 +139,14 @@
 {
 	int (*compare)(const void *, const void *) = userdata;
-	return compare(elem1, elem2);
+	int ret = compare(elem1, elem2);
+	
+	/* Native qsort internals expect this. */
+	if (ret < 0) {
+		return -1;
+	} else if (ret > 0) {
+		return 1;
+	} else {
+		return 0;
+	}
 }
 
@@ -353,5 +363,11 @@
 void *posix_realloc(void *ptr, size_t size)
 {
-	return realloc(ptr, size);
+	if (ptr != NULL && size == 0) {
+		/* Native realloc does not handle this special case. */
+		free(ptr);
+		return NULL;
+	} else {
+		return realloc(ptr, size);
+	}
 }
 
Index: uspace/lib/posix/stdlib/strtol.c
===================================================================
--- uspace/lib/posix/stdlib/strtol.c	(revision 087c87980bf17015f89d56dc5abfb18a9c54e33b)
+++ uspace/lib/posix/stdlib/strtol.c	(revision 102a729e88b697a95ed9ce5fbcd3097ac1b9b456)
@@ -190,5 +190,5 @@
 				/* overflow */
 				errno = ERANGE;
-				result = max_value;
+				result = real_max_value;
 				break;
 			}
Index: uspace/lib/posix/stdlib/strtold.c
===================================================================
--- uspace/lib/posix/stdlib/strtold.c	(revision 087c87980bf17015f89d56dc5abfb18a9c54e33b)
+++ uspace/lib/posix/stdlib/strtold.c	(revision 102a729e88b697a95ed9ce5fbcd3097ac1b9b456)
@@ -547,8 +547,8 @@
 		
 		if (endptr != NULL) {
-			*endptr = (char *) &nptr[i + 3];
-		}
-		errno = ERANGE;
-		return negative ? -0.0l : +0.0l;
+			*endptr = (char *) nptr;
+		}
+		errno = EINVAL;
+		return 0;
 	}
 	
