stderr is seekable? (lseek(2))

Doug White dwhite at gumbysoft.com
Mon Sep 13 20:31:10 PDT 2004


On Tue, 14 Sep 2004, Jun Kuriyama wrote:

>
> When I tested this program, it finished successfully.  But on Linux,
> lseek(2) returns -1 and errno is ESPIPE.
>
> I expected to be returned ESPIPE as Linux did.  Is our behavior
> correct, or there is something wrong?

You might poke -standards about this, someone there probably has a copy
of POSIX and can see waht the required behavior is.

I'm inclined to call this a "bonus feature" on our part :)

>
> -----
> #include <sys/types.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <errno.h>
>
> int
> main(int argc, char **argv)
> {
>   off_t r = lseek(2, 1, SEEK_CUR);
>   printf("r=%d\n", r);
>   if (r == -1) {
>     printf("errno=%d, %s\n", errno, strerror(errno));
>   }
>   return 0;
> }
> -----
>
>
>

-- 
Doug White                    |  FreeBSD: The Power to Serve
dwhite at gumbysoft.com          |  www.FreeBSD.org


More information about the freebsd-arch mailing list