Extra error checking, and other stuff
This commit is contained in:
parent
1050ef1b31
commit
ccc6a3c849
@ -13,6 +13,7 @@ int chrcnt = 0;
|
||||
int lincnt = 1;
|
||||
int yylex(void);
|
||||
extern char* yytext;
|
||||
extern struct conf cf;
|
||||
void yyerror(str)
|
||||
char* str;
|
||||
{
|
||||
@ -82,6 +83,7 @@ devpath:
|
||||
QUOTE PATH QUOTE
|
||||
{
|
||||
lprintf(debug, "Modem dev == %s\n", $2);
|
||||
cf.modemdev = $2;
|
||||
}
|
||||
;
|
||||
%%
|
||||
|
@ -39,5 +39,8 @@ void initialize(void)
|
||||
open_logs();
|
||||
install_handlers();
|
||||
read_config();
|
||||
if(init_modem(cf.modemdev) != 1) {
|
||||
lprintf(warn, "warning: modem didn't initialise properly; see previous messages\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ int init_modem(char* dev)
|
||||
{
|
||||
int lres = 0;
|
||||
modemfd = open(dev, O_RDWR);
|
||||
if(!modemfd) {
|
||||
if(modemfd == -1) {
|
||||
lprintf(error, "Error opening modem %s: %s\n", dev, strerror(errno));
|
||||
return -2;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void handclient(sk)
|
||||
lprintf(debug, "Client said %s.", buffer);
|
||||
}
|
||||
|
||||
void network(void)
|
||||
void network(void) /* name is misleading because we also do modem IO here */
|
||||
{
|
||||
int s, us, sn;
|
||||
fd_set fds;
|
||||
|
Loading…
Reference in New Issue
Block a user