Skip to content

Commit 1e4c893

Browse files
Fixed compiler warnings
1 parent 16ee07a commit 1e4c893

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pink/src/pink_epoll.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ bool PinkEpoll::Register(const PinkItem& it, bool force) {
147147
}
148148
notify_queue_protector_.Unlock();
149149
if (success) {
150-
write(notify_send_fd_, "", 1);
150+
int ret_code = write(notify_send_fd_, "", 1);
151+
if (ret_code < 0) success = false;
151152
}
152153
return success;
153154
}

pink/src/pink_pubsub.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int PubSubThread::Publish(const std::string& channel, const std::string &msg) {
141141
channel_ = channel;
142142
message_ = msg;
143143
// Send signal to ThreadMain()
144-
write(msg_pfd_[1], "", 1);
144+
(void)write(msg_pfd_[1], "", 1);
145145
receiver_mutex_.Lock();
146146
while (receivers_ == -1) {
147147
receiver_rsignal_.Wait();
@@ -384,7 +384,7 @@ void *PubSubThread::ThreadMain() {
384384
pfe = (pink_epoll_->firedevent()) + i;
385385
if (pfe->fd == pink_epoll_->notify_receive_fd()) { // New connection comming
386386
if (pfe->mask & PinkEpoll::kRead) {
387-
read(pink_epoll_->notify_receive_fd(), triger, 1);
387+
(void)read(pink_epoll_->notify_receive_fd(), triger, 1);
388388
{
389389
PinkItem ti = pink_epoll_->notify_queue_pop();
390390
if (ti.notify_type() == kNotiClose) {
@@ -404,7 +404,7 @@ void *PubSubThread::ThreadMain() {
404404
}
405405
if (pfe->fd == msg_pfd_[0]) { // Publish message
406406
if (pfe->mask & PinkEpoll::kRead) {
407-
read(msg_pfd_[0], triger, 1);
407+
(void)read(msg_pfd_[0], triger, 1);
408408
std::string channel, msg;
409409
int32_t receivers = 0;
410410
channel = channel_;

0 commit comments

Comments
 (0)