mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: palani saravanan <busybeesaravanan0072003@yahoo.co.in>
To: linux-kernel@vger.kernel.org
Subject: Behavior of lseek() on a fd opened with 'RDONLY' flag, when seeking goes beyond file size.
Date: Tue, 17 Jun 2008 19:36:53 +0530 (IST)	[thread overview]
Message-ID: <535337.98001.qm@web8712.mail.in.yahoo.com> (raw)

Hi,

   [Forgive me if this is not correct alias for this question. 
    (Behavior of lseek() on a fd opened with 'RDONLY' flag, when seeking goes beyond file size.)]

   In linux, I see that it just goes beyond the file size and returns the resulting offset.
   For example, 'rc = lseek(fd, 4L, SEEK_END);' on a file which has 5 byte contents,
   it returns rc as 9.
   I expect that it would return size of the file, i.e.) 5.

   I am not finding any posix documentation for this either.

   May I know the rational behind this behavior?  
   Does the file pointer internally really points to the new location.?

Thanks,
Saravanan



      Meet people who discuss and share your passions. Go to http://in.promos.yahoo.com/groups/bestofyahoo/

             reply	other threads:[~2008-06-17 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 14:06 palani saravanan [this message]
2008-06-17 14:30 ` David Newall
2008-06-21 15:48 palani saravanan
2008-06-22  2:06 ` David Newall
2008-06-23  8:38 palani saravanan

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=535337.98001.qm@web8712.mail.in.yahoo.com \
    --to=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

Powered by JetHome