public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Newall <davidn@davidnewall.com>
To: palani saravanan <busybeesaravanan0072003@yahoo.co.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Behavior of lseek() on a fd opened with 'RDONLY' flag, when seeking goes beyond file size.
Date: Sun, 22 Jun 2008 11:36:12 +0930	[thread overview]
Message-ID: <485DB394.1040208@davidnewall.com> (raw)
In-Reply-To: <807740.19494.qm@web8703.mail.in.yahoo.com>

palani saravanan wrote:
> Does lseek() permits -ve value as offset, with SEEK_SET mode? ...
>    errno = 0;
>    rd_rc = lseek(rd_fd, -10, SEEK_SET);
> returns rd_rc = -10 and errno remains 0.
>   

No, lseek does not permit negative file offsets, and should return
EINVAL in your example.  You may have discovered a bug.  For reference,
on my system lseek returns -1 and sets errno to EINVAL, as it should.

If you're running a recent kernel it might be worth looking closer into
this; for older kernels it's probably not worth the effort.

  reply	other threads:[~2008-06-22  2:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-21 15:48 Behavior of lseek() on a fd opened with 'RDONLY' flag, when seeking goes beyond file size palani saravanan
2008-06-22  2:06 ` David Newall [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-06-23  8:38 palani saravanan
2008-06-17 14:06 palani saravanan
2008-06-17 14:30 ` David Newall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=485DB394.1040208@davidnewall.com \
    --to=davidn@davidnewall.com \
    --cc=busybeesaravanan0072003@yahoo.co.in \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox