Skip to content

Commit

Permalink
set_interrupt missed an EEXIST test fo the case when an interrupt is …
Browse files Browse the repository at this point in the history
…already running
  • Loading branch information
tonyrog committed Jun 12, 2013
1 parent 8647048 commit e2628bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions c_src/gpio_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,8 +1527,10 @@ static ErlDrvSSizeT gpio_drv_ctl(ErlDrvData d,
if (direction != gpio_direction_in)
goto badarg;
if (gp->interrupt != gpio_interrupt_none) {
if (add_interrupt(ctx, gp) == GPIO_NOK)
goto error;
if (add_interrupt(ctx, gp) == GPIO_NOK) {
if (errno != EEXIST) // active?
goto error;
}
}
gp->interrupt = intval;
gp->target = driver_caller(ctx->port);
Expand Down

0 comments on commit e2628bd

Please sign in to comment.