aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2012-03-12 18:38:45 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-30 21:50:31 +0200
commit7ed92581ee20b77911171355cf1d40c617a0b44b (patch)
treedf619f6b155372ce030d8b55d5ebdd9d49cc0582
parent5c67fb5610e1b707d58fb305d92b81966de452c6 (diff)
input: dahdi: replace exit by return
This is a library, we leave up to the client code to decide when to finish the code execution.
-rw-r--r--src/input/dahdi.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/input/dahdi.c b/src/input/dahdi.c
index ff5cb80..8d3e060 100644
--- a/src/input/dahdi.c
+++ b/src/input/dahdi.c
@@ -425,14 +425,14 @@ struct e1inp_driver dahdi_driver = {
.vty_show = &dahdi_vty_show,
};
-void dahdi_set_bufinfo(int fd, int as_sigchan)
+int dahdi_set_bufinfo(int fd, int as_sigchan)
{
struct dahdi_bufferinfo bi;
int x = 0;
if (ioctl(fd, DAHDI_GET_BUFINFO, &bi)) {
LOGP(DLINP, LOGL_ERROR, "Error getting bufinfo\n");
- exit(-1);
+ return -EIO;
}
if (as_sigchan) {
@@ -446,13 +446,13 @@ void dahdi_set_bufinfo(int fd, int as_sigchan)
if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
LOGP(DLINP, LOGL_ERROR, "Error setting bufinfo\n");
- exit(-1);
+ return -EIO;
}
if (!as_sigchan) {
if (ioctl(fd, DAHDI_AUDIOMODE, &x)) {
LOGP(DLINP, LOGL_ERROR, "Error setting bufinfo\n");
- exit(-1);
+ return -EIO;
}
} else {
int one = 1;
@@ -461,6 +461,7 @@ void dahdi_set_bufinfo(int fd, int as_sigchan)
* as this command will fail if the slot _already_ was a
* signalling slot before :( */
}
+ return 0;
}
static int dahdi_e1_setup(struct e1inp_line *line)
@@ -522,10 +523,13 @@ static int dahdi_e1_setup(struct e1inp_line *line)
LOGP(DLINP, LOGL_ERROR,
"%s could not open %s %s\n",
__func__, openstr, strerror(errno));
- exit(-1);
+ return -EIO;
}
bfd->when = BSC_FD_READ | BSC_FD_EXCEPT;
- dahdi_set_bufinfo(bfd->fd, 1);
+ ret = dahdi_set_bufinfo(bfd->fd, 1);
+ if (ret < 0)
+ return ret;
+
if (!e1i_ts->lapd)
e1i_ts->lapd = lapd_instance_alloc(1,
dahdi_write_msg, bfd, e1inp_dlsap_up,
@@ -543,9 +547,11 @@ static int dahdi_e1_setup(struct e1inp_line *line)
LOGP(DLINP, LOGL_ERROR,
"%s could not open %s %s\n",
__func__, openstr, strerror(errno));
- exit(-1);
+ return -EIO;
}
- dahdi_set_bufinfo(bfd->fd, 0);
+ ret = dahdi_set_bufinfo(bfd->fd, 0);
+ if (ret < 0)
+ return -EIO;
/* We never include the DAHDI B-Channel FD into the
* writeset, since it doesn't support poll() based
* write flow control */