Change file properties to not execute, move socket creatio after sync

in a2pid.c
This commit is contained in:
David Schmenk
2013-06-20 10:13:53 -07:00
parent 474ad076c3
commit c27596aac7
9 changed files with 17 additions and 17 deletions
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -1,4 +1,4 @@
BIN=a2pid a2mon dskread dskwrite bintomon
BIN=a2serclk a2pid a2mon dskread dskwrite bintomon
all: $(BIN)
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+16 -16
View File
@@ -662,22 +662,6 @@ void main(int argc, char **argv)
evrely.type = EV_REL;
evrely.code = REL_Y;
evsync.type = EV_SYN;
/*
* Open socket.
*/
prlog("a2pid: Open server socket\n");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(6502);
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
srvfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (srvfd < 0)
die("error: socket create");
if (bind(srvfd,(struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
die("error: bind socket");
if (listen(srvfd, 1) < 0)
die("error: listen socket");
reqfd = 0;
/*
* Open serial port.
*/
@@ -720,6 +704,22 @@ void main(int argc, char **argv)
}
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
tcsetattr(a2fd, TCSANOW, &newtio);
/*
* Open socket.
*/
prlog("a2pid: Open server socket\n");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(6502);
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
srvfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (srvfd < 0)
die("error: socket create");
if (bind(srvfd,(struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
die("error: bind socket");
if (listen(srvfd, 1) < 0)
die("error: listen socket");
reqfd = 0;
FD_ZERO(&openset);
FD_SET(a2fd, &openset);
FD_SET(srvfd, &openset);
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File