dahdi_cfg: Reduce mass ioctls on non-existing channels
authorRuss Meyerriecks <rmeyerriecks@digium.com>
Wed, 23 Jul 2014 18:20:14 +0000 (13:20 -0500)
committerRuss Meyerriecks <rmeyerriecks@digium.com>
Wed, 23 Jul 2014 21:53:38 +0000 (16:53 -0500)
Logic was calling DAHDI_SPECIFY ioctl on all channels up to maximum channel
limit. Added a short circuit to prevent the ioctl on channels that aren't
configured.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

dahdi_cfg.c

index 432675e..30add83 100644 (file)
@@ -826,8 +826,9 @@ static int apply_fiftysix(void)
        int chanfd;
 
        for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
-               if (skip_channel(x))
+               if (skip_channel(x) || !cc[x].sigtype)
                        continue;
+
                chanfd = open("/dev/dahdi/channel", O_RDWR);
                if (chanfd == -1) {
                        fprintf(stderr,