watcher: Use Windows read/write(2) wrappers instead of compile-conditions

This commit is contained in:
Martin Willi
2014-11-21 12:02:08 +01:00
parent a301a9c939
commit 6e1d3f3615
-8
View File
@@ -118,11 +118,7 @@ static void update(private_watcher_t *this)
this->pending = TRUE; this->pending = TRUE;
if (this->notify[1] != -1) if (this->notify[1] != -1)
{ {
#ifdef WIN32
if (send(this->notify[1], buf, sizeof(buf), 0) == -1)
#else
if (write(this->notify[1], buf, sizeof(buf)) == -1) if (write(this->notify[1], buf, sizeof(buf)) == -1)
#endif
{ {
DBG1(DBG_JOB, "notifying watcher failed: %s", strerror(errno)); DBG1(DBG_JOB, "notifying watcher failed: %s", strerror(errno));
} }
@@ -338,11 +334,7 @@ static job_requeue_t watch(private_watcher_t *this)
{ {
while (TRUE) while (TRUE)
{ {
#ifdef WIN32
len = recv(this->notify[0], buf, sizeof(buf), 0);
#else
len = read(this->notify[0], buf, sizeof(buf)); len = read(this->notify[0], buf, sizeof(buf));
#endif
if (len == -1) if (len == -1)
{ {
if (errno != EAGAIN && errno != EWOULDBLOCK) if (errno != EAGAIN && errno != EWOULDBLOCK)