happily messing up with raw devices (aka: lseek problems)

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Sep 7 18:36:00 GMT 2005


Try this:

On Sep  7 20:11, Lapo Luchini wrote:
> At the bare minumum it all boils down to:
> 
> % cat short.c
> #include <sys/stat.h>
> #include <errno.h>
> #include <fcntl.h>
> #include <stdio.h>

  #include <unistd.h>

> #define GAG_OFFSET 0x59BD
> main() {
>   char sect[512];
>   int dev, i;
>   dev = open("/dev/sdb", O_RDONLY | O_BINARY, 0);
>   if (dev < 0) perror("open");
>   i = lseek(dev, GAG_OFFSET & (~0x1FF), SEEK_SET);
>   if (i < 0) perror("seek");
> }
> % gcc -O -ggdb -o short short.c
> % ./short
> seek: Invalid argument

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list