git: 2c0c288cb092 - main - devel/libfixposix: Import newer upstream fix
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Jan 2022 09:30:35 UTC
The branch main has been updated by arrowd:
URL: https://cgit.FreeBSD.org/ports/commit/?id=2c0c288cb09231ccdfd7ec6f3616121c923d51ad
commit 2c0c288cb09231ccdfd7ec6f3616121c923d51ad
Author: Filipe da Silva Santos <ports@shiori.com.br>
AuthorDate: 2022-01-20 09:27:28 +0000
Commit: Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2022-01-20 09:29:37 +0000
devel/libfixposix: Import newer upstream fix
Last fix was not complete, since it didn't take `EAGAIN' semantic
differences between Linux and FreeBSD in consideration.
Reported by: Vasily Postnicov <shamaz.masum@gmail.com>
Obtained from: https://github.com/sionescu/libfixposix/commit/cc50634551849cc667edd5b5b29f6f54ae2f9bc4
Differential Revision: https://reviews.freebsd.org/D33931
---
devel/libfixposix/Makefile | 2 +-
devel/libfixposix/files/patch-src_lib_sendfile.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/devel/libfixposix/Makefile b/devel/libfixposix/Makefile
index 0bf0e398cafc..1cebb9f7f059 100644
--- a/devel/libfixposix/Makefile
+++ b/devel/libfixposix/Makefile
@@ -1,7 +1,7 @@
PORTNAME= libfixposix
DISTVERSIONPREFIX= v
DISTVERSION= 0.4.3
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MAINTAINER= ports@shiori.com.br
diff --git a/devel/libfixposix/files/patch-src_lib_sendfile.c b/devel/libfixposix/files/patch-src_lib_sendfile.c
index c69cc84fa1ed..4c80ea88e027 100644
--- a/devel/libfixposix/files/patch-src_lib_sendfile.c
+++ b/devel/libfixposix/files/patch-src_lib_sendfile.c
@@ -4,7 +4,7 @@ mimicking Linux sendfile(2).
Submited to upstream by Vasily Postnicov (shamaz.mazum@gmail.com),
see https://github.com/sionescu/libfixposix/pull/18.
---- src/lib/sendfile.c.orig 2018-02-19 22:24:10 UTC
+--- src/lib/sendfile.c.orig 2022-01-18 20:14:50 UTC
+++ src/lib/sendfile.c
@@ -38,6 +38,7 @@ int sendfile(int, int, off_t, off_t *, void *, int);
#endif
@@ -14,7 +14,7 @@ see https://github.com/sionescu/libfixposix/pull/18.
DSO_PUBLIC ssize_t
lfp_sendfile(int out_fd, int in_fd, off_t offset, size_t nbytes)
-@@ -46,18 +47,21 @@ lfp_sendfile(int out_fd, int in_fd, off_t offset, size
+@@ -46,18 +47,25 @@ lfp_sendfile(int out_fd, int in_fd, off_t offset, size
# if defined(__linux__)
off_t off = offset;
return (ssize_t) sendfile(out_fd, in_fd, &off, nbytes);
@@ -23,15 +23,19 @@ see https://github.com/sionescu/libfixposix/pull/18.
-# elif defined(__DragonFly__)
- return (ssize_t) sendfile(in_fd, out_fd, offset, nbytes, NULL, NULL, 0);
+# elif defined(__FreeBSD__) || defined(__DragonFly__)
-+ off_t sbytes;
++ off_t sbytes = 0;
+ int res = sendfile(in_fd, out_fd, offset, nbytes, NULL, &sbytes, 0);
-+ if (res == 0) { return sbytes; }
-+ return res;
++ if (res == 0 || (res < 0 && errno == EAGAIN && sbytes > 0)) {
++ return sbytes;
++ }
++ return -1;
# elif defined(__APPLE__)
off_t len = nbytes;
- return (ssize_t) sendfile(in_fd, out_fd, offset, &len, NULL, 0);
+ int res = sendfile(in_fd, out_fd, offset, &len, NULL, 0);
-+ if (res == 0) { return len; }
++ if (res == 0 || (res < 0 && errno == EAGAIN && len > 0)) {
++ return len;
++ }
+ return -1;
# else
# error "It appears that this OS has sendfile(), but LFP doesn't use it at the moment"