bug-gnulib
[Top][All Lists]
Advanced

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

Re: how do I check that an FD is open?


From: Jim Meyering
Subject: Re: how do I check that an FD is open?
Date: Sun, 14 Dec 2008 21:46:21 +0100

Sam Steingold <address@hidden> wrote:
> How do I figure out if the fd (specifically, stdin=0) is open?
> apparently it is closed when the application is run by nohup.
> the only thing I could figure out so far is fstat: when 0 is open,
> st_mode is 8592, when it is closed it is 8630...

Hi Sam,

This is very lightweight, and does this job.  The test,

  fcntl (fd, F_GETFD) < 0

indicates that fd is not open.




reply via email to

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