Merge "make sure to ignore SIGPIPE in the write side of BitTube"

This commit is contained in:
Mathias Agopian 2012-02-06 19:18:57 -08:00 committed by Android (Google) Code Review
commit 619258483f

View File

@ -17,8 +17,9 @@
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <utils/Errors.h> #include <utils/Errors.h>
@ -38,6 +39,8 @@ BitTube::BitTube()
mSendFd = fds[1]; mSendFd = fds[1];
fcntl(mReceiveFd, F_SETFL, O_NONBLOCK); fcntl(mReceiveFd, F_SETFL, O_NONBLOCK);
fcntl(mSendFd, F_SETFL, O_NONBLOCK); fcntl(mSendFd, F_SETFL, O_NONBLOCK);
// ignore SIGPIPE, we handle write errors through EPIPE instead
signal(SIGPIPE, SIG_IGN);
} else { } else {
mReceiveFd = -errno; mReceiveFd = -errno;
ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd)); ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd));