[PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johann Felix Soden
Date: Tuesday, February 19, 2008 - 1:14 pm

From: Johann Felix Soden <johfel@users.sourceforge.net>

With SPLICE_F_NONBLOCK sys_tee should return number of duplicated bytes,
not only -EAGAIN on success.

This patch also solves the problem, which is described on
http://article.gmane.org/gmane.linux.kernel/642502.

Signed-off-by: Johann Felix Soden <johfel@users.sourceforge.net>
---
 fs/splice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 9b559ee..184fd66 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1711,7 +1711,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
 			ret = link_opipe_prep(opipe, flags);
 			if (!ret) {
 				ret = link_pipe(ipipe, opipe, len, flags);
-				if (!ret && (flags & SPLICE_F_NONBLOCK))
+				if (ret < 0 && (flags & SPLICE_F_NONBLOCK))
 					ret = -EAGAIN;
 			}
 		}
-- 
1.5.4.2


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] splice: fix problem with sys_tee and SPLICE_F_NONBLOCK, Johann Felix Soden, (Tue Feb 19, 1:14 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_ ..., Johann Felix Soden, (Tue Feb 19, 2:12 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_ ..., Johann Felix Soden, (Tue Feb 19, 2:47 pm)
Re: [PATCH] splice: fix problem with sys_tee and SPLICE_F_ ..., Johann Felix v. Sode ..., (Wed Feb 20, 3:07 am)