about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-09-26 00:59:28 -0400
committerRich Felker <dalias@aerifal.cx>2011-09-26 00:59:28 -0400
commitfd142e5ec44aaafffbb8bb4ea41c4288d3fa937a (patch)
tree23fac00d2f8a9d7851d336d9bbb7d3417edc6980 /src
parent729d6368bdf9faa33299cdfa68efc7422af33bd7 (diff)
downloadmusl-fd142e5ec44aaafffbb8bb4ea41c4288d3fa937a.tar.gz
musl-fd142e5ec44aaafffbb8bb4ea41c4288d3fa937a.tar.xz
musl-fd142e5ec44aaafffbb8bb4ea41c4288d3fa937a.zip
cleanup various minor issues reported by nsz
the changes to syscall_ret are mostly no-ops in the generated code,
just cleanup of type issues and removal of some implementation-defined
behavior. the one exception is the change in the comparison value,
which is fixed so that 0xf...f000 (which in principle could be a valid
return value for mmap, although probably never in reality) is not
treated as an error return.
Diffstat (limited to 'src')
-rw-r--r--src/internal/syscall_ret.c6
-rw-r--r--src/linux/sbrk.c4
-rw-r--r--src/time/__asctime.c3
-rw-r--r--src/unistd/setpgid.c2
4 files changed, 8 insertions, 7 deletions
diff --git a/src/internal/syscall_ret.c b/src/internal/syscall_ret.c
index 4f159e0b..e4a1bdbe 100644
--- a/src/internal/syscall_ret.c
+++ b/src/internal/syscall_ret.c
@@ -3,9 +3,9 @@
 
 long __syscall_ret(unsigned long r)
 {
-	if (r >= (unsigned long)-1 - 4096) {
-		errno = -(long)r;
+	if (r > -4096UL) {
+		errno = -r;
 		return -1;
 	}
-	return (long)r;
+	return r;
 }
diff --git a/src/linux/sbrk.c b/src/linux/sbrk.c
index 5fab74be..36437653 100644
--- a/src/linux/sbrk.c
+++ b/src/linux/sbrk.c
@@ -1,7 +1,7 @@
-#include <stddef.h>
+#include <stdint.h>
 #include "syscall.h"
 
-void *sbrk(ptrdiff_t inc)
+void *sbrk(intptr_t inc)
 {
 	unsigned long cur = syscall(SYS_brk, 0);
 	if (inc && syscall(SYS_brk, cur+inc) != cur+inc) return (void *)-1;
diff --git a/src/time/__asctime.c b/src/time/__asctime.c
index d31f6347..7cc4f503 100644
--- a/src/time/__asctime.c
+++ b/src/time/__asctime.c
@@ -1,6 +1,7 @@
 #include <time.h>
 #include <stdio.h>
 #include <langinfo.h>
+#include "atomic.h"
 
 const char *__langinfo(nl_item);
 
@@ -21,7 +22,7 @@ char *__asctime(const struct tm *tm, char *buf)
 		 * application developers that they may not be so lucky
 		 * on other implementations (e.g. stack smashing..).
 		 */
-		*(volatile int*)0 = 0;
+		a_crash();
 	}
 	return buf;
 }
diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c
index 4a5a3d6b..06160695 100644
--- a/src/unistd/setpgid.c
+++ b/src/unistd/setpgid.c
@@ -1,7 +1,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-pid_t setpgid(pid_t pid, pid_t pgid)
+int setpgid(pid_t pid, pid_t pgid)
 {
 	return syscall(SYS_setpgid, pid, pgid);
 }