From 3b06c128cf2799cec8f7524dc11c4e6c320fe4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 16:05:52 -0200 Subject: bionic: ftell() returns a long, not an int MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Goddard Rosa --- libc/bionic/pututline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc/bionic') diff --git a/libc/bionic/pututline.c b/libc/bionic/pututline.c index 2449068..c8427f7 100644 --- a/libc/bionic/pututline.c +++ b/libc/bionic/pututline.c @@ -34,7 +34,7 @@ void pututline(struct utmp* utmp) { FILE* f; struct utmp u; - int i; + long i; if (!(f = fopen(_PATH_UTMP, "w+"))) return; -- cgit v1.1 From a28336c73542f5df1c03de4c142070f408e8d5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 16:21:07 -0200 Subject: bionic: on pthread_join(), avoid extra check in case we find the thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... by using similar logic as used in pthread_detach(). Signed-off-by: André Goddard Rosa --- libc/bionic/pthread.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libc/bionic') diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 8171aac..7d4056d 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -597,13 +597,12 @@ int pthread_join(pthread_t thid, void ** ret_val) for (thread = gThreadList; thread != NULL; thread = thread->next) if (thread == (pthread_internal_t*)thid) - break; + goto FoundIt; - if (!thread) { - pthread_mutex_unlock(&gThreadListLock); - return ESRCH; - } + pthread_mutex_unlock(&gThreadListLock); + return ESRCH; +FoundIt: if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) { pthread_mutex_unlock(&gThreadListLock); return EINVAL; -- cgit v1.1 From 291100c795fc98f4a1320e7de0dbef2615cd8fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 16:32:56 -0200 Subject: bionic: remove unneeded variable from chk_realloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and simplify the generated code. Signed-off-by: André Goddard Rosa --- libc/bionic/malloc_leak.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libc/bionic') diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c index 305f954..ad1d2b4 100644 --- a/libc/bionic/malloc_leak.c +++ b/libc/bionic/malloc_leak.c @@ -665,8 +665,9 @@ void* chk_realloc(void* mem, size_t bytes) } if (new_buffer) { - size_t size = (bytes < old_bytes)?(bytes):(old_bytes); - memcpy(new_buffer, mem, size); + if (bytes > old_bytes) + bytes = old_bytes; + memcpy(new_buffer, mem, bytes); chk_free(mem); } -- cgit v1.1 From 699237baf54af3395311ad71ebedce20745c4cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 17:48:07 -0200 Subject: bionic: equalize the program name between ssp.c and libc_init_common.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... for the consistency sake. Signed-off-by: André Goddard Rosa --- libc/bionic/ssp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc/bionic') diff --git a/libc/bionic/ssp.c b/libc/bionic/ssp.c index 20794f4..f83b2a4 100644 --- a/libc/bionic/ssp.c +++ b/libc/bionic/ssp.c @@ -76,9 +76,9 @@ void __stack_chk_fail(void) sigprocmask(SIG_BLOCK, &sigmask, NULL); /* Use /proc/self/exe link to obtain the program name for logging - * purposes. If it's not available, we set it to "unknown" */ + * purposes. If it's not available, we set it to "" */ if ((count = readlink("/proc/self/exe", path, sizeof(path) - 1)) == -1) { - strlcpy(path, "unknown", sizeof(path)); + strlcpy(path, "", sizeof(path)); } else { path[count] = '\0'; } -- cgit v1.1