Commit 99d761b9 authored by Leigh Stoller's avatar Leigh Stoller

Fix up ifdefs so that we can build both sockets based version and

older tty version at the same time. We use that older version outside
the testbed.
parent 4f676455
......@@ -5,7 +5,7 @@ SUBDIR = capture
include $(OBJDIR)/Makeconf
all: capture capserver
all: capture capserver capture-tty
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -17,10 +17,13 @@ DESTDIR=
# Define LOG_DROPS to record warnings in syslog whenever chars were dropped
# due to the output device/pty being full.
#
CFLAGS= -g -O2 -DLOG_DROPS -DUSESOCKETS
CFLAGS= -g -O2 -DLOG_DROPS
capture: capture.c capdecls.h
cc $(CFLAGS) -o capture $<
cc $(CFLAGS) -DUSESOCKETS -o capture $<
capture-tty: capture.c capdecls.h
cc $(CFLAGS) -o capture-tty $<
capserver: capserver.c capdecls.h
cc $(CFLAGS) $(DBFLAGS) -o capserver $< \
......
......@@ -379,13 +379,13 @@ capture()
* and close the slave again.
*/
#ifdef __FreeBSD__
if ((n = open(Ttyname, O_RDONLY)) < 0)
if ((i = open(Ttyname, O_RDONLY)) < 0)
die("%s: open: %s", Ttyname, geterr(errno));
#endif
if (fcntl(ptyfd, F_SETFL, O_NONBLOCK) < 0)
die("%s: fcntl(O_NONBLOCK): %s", Ptyname, geterr(errno));
#ifdef __FreeBSD__
close(n);
close(i);
#endif
#endif /* USESOCKETS */
......@@ -416,6 +416,7 @@ capture()
}
#endif
fds = sfds;
timeout.tv_usec = 0;
#ifdef USESOCKETS
if (needshake)
timeout.tv_sec = 15;
......@@ -436,9 +437,6 @@ capture()
handshake();
continue;
}
#else
warn("No fds ready!");
sleep(1);
#endif
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment