lkml.org 
[lkml]   [2001]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Possible problem with zero-copy TCP and sendfile()
Wolfgang Rohdewald wrote:
: On Tuesday 17 April 2001 22:36, Jan Kasprzak wrote:
: > +    if (len == -1 || len > 0 && len < count) {
:
: are you sure there are no missing () ?
:
: if ((len == -1) || (len > 0) && (len < count)) {
:
: assumig that && has precedence over || (I believe so)

Yes, but the precedence of ==, <, and > is even higher.
However, I've found a problem with the previous patch: The first chunk should
read:

- if((len = sendfile(session.d->outf->fd, retr_fd, offset, count)) == -1) {
+ len = sendfile(session.d->outf->fd, retr_fd, offset, count);
+ if (len == -1 || len > 0 && len < count) {
+ if (len != -1)
+ errno = EINTR;

i.e. we should not overwrite errno, when it is valid.

-Yenya

PS.: You can find the C operators precedence for example at
http://www.howstuffworks.com/c14.htm (found by Google).

--
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz> http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz 0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\ Czech Linux Homepage: http://www.linux.cz/ ///
Mantra: "everything is a stream of bytes". Repeat until enlightened. --Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.074 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site