lkml.org 
[lkml]   [2008]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Behavior of lseek() on a fd opened with 'RDONLY' flag, when seeking goes beyond file size.
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.


\
 
 \ /
  Last update: 2008-06-22 04:09    [from the cache]
©2003-2011 Jasper Spaans