From 0ba9411d4fa6e17ef377ea7602dd35166229e8f7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 28 Jun 2000 08:56:07 +0000 Subject: Better file check for progress-to control. svn path=/trunk/; revision=2909 --- daemon.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'daemon.c') diff --git a/daemon.c b/daemon.c index c588ae47..db6ee78b 100644 --- a/daemon.c +++ b/daemon.c @@ -205,4 +205,16 @@ nottyDetach: return(0); } +flag isafile(int fd) +/* is the given fd attached to a file? (used to control logging) */ +{ + struct stat stbuf; + + if (fstat(fd, &stbuf)) + return(0); + else if (stbuf.st_mode & (S_IFREG | S_IFBLK)) + return(1); + return(0); +} + /* daemon.c ends here */ -- cgit v1.2.3