Merge "Increase the size of the system-wide dns cache"
diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
index a50185f..2fe2a4e 100644
--- a/libc/unistd/exec.c
+++ b/libc/unistd/exec.c
@@ -195,9 +195,9 @@
(void)writev(STDERR_FILENO, iov, 3);
continue;
}
- bcopy(p, buf, lp);
+ memcpy(buf, p, lp);
buf[lp] = '/';
- bcopy(name, buf + lp + 1, ln);
+ memcpy(buf + lp + 1, name, ln);
buf[lp + ln + 1] = '\0';
retry: (void)execve(bp, argv, environ);
@@ -217,7 +217,7 @@
goto done;
memp[0] = "sh";
memp[1] = bp;
- bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
+ memcpy(memp + 2, argv + 1, cnt * sizeof(char *));
(void)execve(_PATH_BSHELL, memp, environ);
goto done;
case ENOMEM:
diff --git a/linker/debugger.c b/linker/debugger.c
index 648dc78..ef8286c 100644
--- a/linker/debugger.c
+++ b/linker/debugger.c
@@ -126,6 +126,7 @@
*/
void debugger_signal_handler(int n, siginfo_t* info, void* unused)
{
+ char msgbuf[128];
unsigned tid;
int s;
@@ -134,7 +135,7 @@
tid = gettid();
s = socket_abstract_client("android:debuggerd", SOCK_STREAM);
- if(s >= 0) {
+ if (s >= 0) {
/* debugger knows our pid from the credentials on the
* local socket but we need to tell it our tid. It
* is paranoid and will verify that we are giving a tid
@@ -147,9 +148,24 @@
/* if the write failed, there is no point to read on
* the file descriptor. */
RETRY_ON_EINTR(ret, read(s, &tid, 1));
+ int savedErrno = errno;
notify_gdb_of_libraries();
+ errno = savedErrno;
}
+
+ if (ret < 0) {
+ /* read or write failed -- broken connection? */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Failed while talking to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
+ }
+
close(s);
+ } else {
+ /* socket failed; maybe process ran out of fds */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Unable to open connection to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
}
/* remove our net so we fault for real when we return */