This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]