Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/bta2dpd/bta2dpd Avoid running of the end of the arr...



details:   https://anonhg.NetBSD.org/src/rev/7b4af01f8549
branches:  trunk
changeset: 1010632:7b4af01f8549
user:      nat <nat%NetBSD.org@localhost>
date:      Sun May 31 06:17:23 2020 +0000

description:
Avoid running of the end of the array if a file cannot be opened.

Found by plunky@.

diffstat:

 usr.sbin/bta2dpd/bta2dpd/bta2dpd.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 0514a160ccd9 -r 7b4af01f8549 usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
--- a/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c        Sun May 31 04:56:35 2020 +0000
+++ b/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c        Sun May 31 06:17:23 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.6 2019/07/27 20:10:29 nakayama Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.7 2020/05/31 06:17:23 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -844,6 +844,7 @@
        len = stream(fd, sc, channel_mode, frequency, bands, blocks,
            alloc_method, bitpool, mtu, volume);
 
+next_file:
        if (len == -1 && currentFileInd >= numfiles -1) {
                event_del(&interrupt_ev);
                close(fd);
@@ -851,7 +852,6 @@
                exit(1);
        } else if (len == -1) {
                close(fd);
-next_file:
                currentFileInd++;
                audfile = open(files2open[currentFileInd], O_RDONLY);
                if (audfile < 0) {



Home | Main Index | Thread Index | Old Index