[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw lseek bug

From: Bruno Haible
Subject: Re: mingw lseek bug
Date: Thu, 24 May 2007 12:08:06 +0200
User-agent: KMail/1.5.4

Brian Dessent wrote:
> > However, I'm not sure on mingw how to detect whether an fd is open on a
> > regular file vs. a pipe.  Any ideas?
> Check out ser-mingw.c from gdb, they have a fair amount of MinGW pipe/fd
> handling code there, e.g.
> static int
> fd_is_pipe (int fd)
> {
>   if (PeekNamedPipe ((HANDLE) _get_osfhandle (fd), NULL, 0, NULL, NULL,
> NULL))
>     return 1;
>   else
>     return 0;
> }

But there are other types of devices as well, such as special character
devices (COM: and consoles). It looks safer to include only the regular
  GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_DISK.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]