[lwatch-cvs] files/src lwatch.c,1.13,1.14
Brought to you by:
arturcz
|
From: <ar...@us...> - 2003-04-03 15:09:37
|
Update of /cvsroot/lwatch/files/src
In directory sc8-pr-cvs1:/tmp/cvs-serv31782/src
Modified Files:
lwatch.c
Log Message:
- we are not supporting regular files for now
- dealing with end of input file - first try
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** lwatch.c 27 Mar 2003 16:26:37 -0000 1.13
--- lwatch.c 3 Apr 2003 15:09:29 -0000 1.14
***************
*** 64,67 ****
--- 64,70 ----
#endif
} else {
+ struct stat sbuf;
+ io_check(stat(lw_conf.fifo_file,&sbuf),lw_conf.fifo_file);
+ if(!S_ISFIFO(sbuf.st_mode)) die("ERROR: Regular file are not supported for now. See manual for details\n");
io_check(fd=open(lw_conf.fifo_file,O_RDONLY),lw_conf.fifo_file);
#ifdef DEBUG
***************
*** 79,87 ****
if(input.revents==POLLHUP) {
/* other end closed fifo */
#ifdef DEBUG
! printf("syslog closed second end of fifo %s\nTrying to reopen\n",lw_conf.fifo_file);
#endif
! /* trying to reopen or die */
! io_check(fd=open(lw_conf.fifo_file,O_RDONLY),lw_conf.fifo_file);
}
if(res<1) continue;
--- 82,101 ----
if(input.revents==POLLHUP) {
/* other end closed fifo */
+ if(fd) {
+ /* from fifo */
#ifdef DEBUG
! printf("syslog closed second end of fifo %s\nTrying to reopen\n",lw_conf.fifo_file);
#endif
! /* trying to reopen or die */
! io_check(fd=open(lw_conf.fifo_file,O_RDONLY),lw_conf.fifo_file);
! input.fd=fd;
! } else {
! /* from stdin */
! #ifdef DEBUG
! printf("end of file on stdin, exitting...\n");
! #endif
! loop=0;
! }
! continue;
}
if(res<1) continue;
|