summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conn_write.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-08-17 12:28:40 +0300
committerMax Romanov <max.romanov@nginx.com>2020-08-17 12:28:40 +0300
commit4ac7a6f55fb628e67fec97568e9724719d8a9e0a (patch)
tree4deb6d07dab0421b624231a0c141d686b25581dc /src/nxt_conn_write.c
parenta13018fecb9fd2565b3db9762009927269e1c77d (diff)
downloadunit-4ac7a6f55fb628e67fec97568e9724719d8a9e0a.tar.gz
unit-4ac7a6f55fb628e67fec97568e9724719d8a9e0a.tar.bz2
Style: changing preprocessor directives.
Using #if directives instead of #ifdef the same way as in other places.
Diffstat (limited to 'src/nxt_conn_write.c')
-rw-r--r--src/nxt_conn_write.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/nxt_conn_write.c b/src/nxt_conn_write.c
index d7a6a8da..3e08e43f 100644
--- a/src/nxt_conn_write.c
+++ b/src/nxt_conn_write.c
@@ -246,24 +246,30 @@ nxt_sendfile(int fd, int s, off_t pos, size_t size)
{
ssize_t res;
-#ifdef NXT_HAVE_MACOSX_SENDFILE
+#if (NXT_HAVE_MACOSX_SENDFILE)
+
off_t sent = size;
int rc = sendfile(fd, s, pos, &sent, NULL, 0);
res = (rc == 0 || sent > 0) ? sent : -1;
-#endif
-#ifdef NXT_HAVE_FREEBSD_SENDFILE
+#elif (NXT_HAVE_FREEBSD_SENDFILE)
+
off_t sent = 0;
int rc = sendfile(fd, s, pos, size, NULL, &sent, 0);
res = (rc == 0 || sent > 0) ? sent : -1;
-#endif
-#ifdef NXT_HAVE_LINUX_SENDFILE
+#elif (NXT_HAVE_LINUX_SENDFILE)
+
res = sendfile(s, fd, &pos, size);
+
+#else
+
+ res = -1;
+
#endif
return res;