Merge "adb: replace failing exits in adbd with abort()." am: eb62619ff9
am: 4e1149bb15
* commit '4e1149bb152829a016873bbc7795646b5ff5f384':
adb: replace failing exits in adbd with abort().
Change-Id: I78b30130181d09a7755a48c6b769e33def622f7b
This commit is contained in:
commit
666d9aa507
29
adb/adb.cpp
29
adb/adb.cpp
|
@ -65,21 +65,34 @@ std::string adb_version() {
|
|||
void fatal(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "error: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
|
||||
#if ADB_HOST
|
||||
fprintf(stderr, "error: %s\n", buf);
|
||||
#else
|
||||
LOG(ERROR) << "error: " << buf;
|
||||
#endif
|
||||
|
||||
va_end(ap);
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
|
||||
void fatal_errno(const char* fmt, ...) {
|
||||
int err = errno;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
fprintf(stderr, "error: %s: ", strerror(errno));
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
|
||||
#if ADB_HOST
|
||||
fprintf(stderr, "error: %s: %s\n", buf, strerror(err));
|
||||
#else
|
||||
LOG(ERROR) << "error: " << buf << ": " << strerror(err);
|
||||
#endif
|
||||
|
||||
va_end(ap);
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
|
||||
apacket* get_apacket(void)
|
||||
|
|
|
@ -412,7 +412,7 @@ int Subprocess::OpenPtyChildFd(const char* pts_name, ScopedFd* error_sfd) {
|
|||
for (const char* message : messages) {
|
||||
WriteFdExactly(error_sfd->fd(), message);
|
||||
}
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (make_pty_raw_) {
|
||||
|
@ -421,7 +421,7 @@ int Subprocess::OpenPtyChildFd(const char* pts_name, ScopedFd* error_sfd) {
|
|||
int saved_errno = errno;
|
||||
WriteFdExactly(error_sfd->fd(), "tcgetattr failed: ");
|
||||
WriteFdExactly(error_sfd->fd(), strerror(saved_errno));
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
|
||||
cfmakeraw(&tattr);
|
||||
|
@ -429,7 +429,7 @@ int Subprocess::OpenPtyChildFd(const char* pts_name, ScopedFd* error_sfd) {
|
|||
int saved_errno = errno;
|
||||
WriteFdExactly(error_sfd->fd(), "tcsetattr failed: ");
|
||||
WriteFdExactly(error_sfd->fd(), strerror(saved_errno));
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue