public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* lseek(0,...) in snapshot differs from b20.1
@ 1999-09-20  9:43 Paul Berrevoets
  1999-09-20 10:12 ` Mumit Khan
  1999-09-30 23:42 ` Paul Berrevoets
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Berrevoets @ 1999-09-20  9:43 UTC (permalink / raw)
  To: cygwin-list

#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
int
main()
{
    int rc = lseek(0, (off_t)0, SEEK_CUR);
    printf("%d %d\n", rc, rc < 0 ? errno : 0);
    return 0;
}

Ouput using b20.1:
0 0

Output using snapshot 1999-09-17:
-1 9

If this change is intentional, could you please explain the rationale?
--
Regards,
Paul Berrevoets



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lseek(0,...) in snapshot differs from b20.1
  1999-09-20  9:43 lseek(0,...) in snapshot differs from b20.1 Paul Berrevoets
@ 1999-09-20 10:12 ` Mumit Khan
  1999-09-30 23:42   ` Mumit Khan
  1999-09-30 23:42 ` Paul Berrevoets
  1 sibling, 1 reply; 4+ messages in thread
From: Mumit Khan @ 1999-09-20 10:12 UTC (permalink / raw)
  To: Paul Berrevoets; +Cc: cygwin-list

Paul Berrevoets <paul@swi.com> writes:
> #include <sys/types.h>
> #include <unistd.h>
> #include <errno.h>
> int
> main()
> {
>     int rc = lseek(0, (off_t)0, SEEK_CUR);
>     printf("%d %d\n", rc, rc < 0 ? errno : 0);
>     return 0;
> }
> 
> Ouput using b20.1:
> 0 0
> 
> Output using snapshot 1999-09-17:
> -1 9
> 
> If this change is intentional, could you please explain the rationale?

POSIX says something like "Some  devices  are incapable of seeking and 
POSIX does not specify which devices must support it." Linux for example
will set the errno to ESPIPE with your code (which Cygwin should follow
as well instead of using ENODEV); HPUX will return the total number
of total number of bytes written to the descriptor and so on.

Simply put, assuming that stdin is seekable is non-portable and should
be avoided at all costs. I tend to use isatty(), and avoid calling lseek
on a tty device. 

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* lseek(0,...) in snapshot differs from b20.1
  1999-09-20  9:43 lseek(0,...) in snapshot differs from b20.1 Paul Berrevoets
  1999-09-20 10:12 ` Mumit Khan
@ 1999-09-30 23:42 ` Paul Berrevoets
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Berrevoets @ 1999-09-30 23:42 UTC (permalink / raw)
  To: cygwin-list

#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
int
main()
{
    int rc = lseek(0, (off_t)0, SEEK_CUR);
    printf("%d %d\n", rc, rc < 0 ? errno : 0);
    return 0;
}

Ouput using b20.1:
0 0

Output using snapshot 1999-09-17:
-1 9

If this change is intentional, could you please explain the rationale?
--
Regards,
Paul Berrevoets



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lseek(0,...) in snapshot differs from b20.1
  1999-09-20 10:12 ` Mumit Khan
@ 1999-09-30 23:42   ` Mumit Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Mumit Khan @ 1999-09-30 23:42 UTC (permalink / raw)
  To: Paul Berrevoets; +Cc: cygwin-list

Paul Berrevoets <paul@swi.com> writes:
> #include <sys/types.h>
> #include <unistd.h>
> #include <errno.h>
> int
> main()
> {
>     int rc = lseek(0, (off_t)0, SEEK_CUR);
>     printf("%d %d\n", rc, rc < 0 ? errno : 0);
>     return 0;
> }
> 
> Ouput using b20.1:
> 0 0
> 
> Output using snapshot 1999-09-17:
> -1 9
> 
> If this change is intentional, could you please explain the rationale?

POSIX says something like "Some  devices  are incapable of seeking and 
POSIX does not specify which devices must support it." Linux for example
will set the errno to ESPIPE with your code (which Cygwin should follow
as well instead of using ENODEV); HPUX will return the total number
of total number of bytes written to the descriptor and so on.

Simply put, assuming that stdin is seekable is non-portable and should
be avoided at all costs. I tend to use isatty(), and avoid calling lseek
on a tty device. 

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-09-30 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-20  9:43 lseek(0,...) in snapshot differs from b20.1 Paul Berrevoets
1999-09-20 10:12 ` Mumit Khan
1999-09-30 23:42   ` Mumit Khan
1999-09-30 23:42 ` Paul Berrevoets

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).