(typed_wu) [_WIN32]: Remove special case, just use writev().

This commit is contained in:
Markus Armbruster 2007-10-27 14:40:10 +00:00
parent f1a39e676b
commit 88b44bffd3

View file

@ -35,9 +35,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdarg.h> #include <stdarg.h>
#if !defined(_WIN32)
#include <sys/uio.h> #include <sys/uio.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "file.h" #include "file.h"
#include "misc.h" #include "misc.h"
@ -120,9 +118,7 @@ typed_wu(natid from, natid to, char *message, int type)
int len; int len;
struct telstr tel; struct telstr tel;
struct natstr *np; struct natstr *np;
#if !defined(_WIN32)
struct iovec iov[2]; struct iovec iov[2];
#endif
int fd; int fd;
char box[1024]; char box[1024];
int write_ok = 0; int write_ok = 0;
@ -154,16 +150,11 @@ typed_wu(natid from, natid to, char *message, int type)
} }
tel.tel_length = len; tel.tel_length = len;
tel.tel_type = type; tel.tel_type = type;
#if !defined(_WIN32)
iov[0].iov_base = &tel; iov[0].iov_base = &tel;
iov[0].iov_len = sizeof(tel); iov[0].iov_len = sizeof(tel);
iov[1].iov_base = message; iov[1].iov_base = message;
iov[1].iov_len = len; iov[1].iov_len = len;
if (writev(fd, iov, 2) < (int)(iov[0].iov_len + iov[1].iov_len)) { if (writev(fd, iov, 2) < (int)(iov[0].iov_len + iov[1].iov_len)) {
#else
if ((write(fd, &tel, sizeof(tel)) != sizeof(tel)) ||
(write(fd, message, len) != len)) {
#endif
logerror("telegram 'write' to #%d failed", to); logerror("telegram 'write' to #%d failed", to);
} else } else
write_ok = 1; write_ok = 1;