Add guard around get_mcn for null p_cdio.
This commit is contained in:
1
test/driver/.gitignore
vendored
1
test/driver/.gitignore
vendored
@@ -9,6 +9,7 @@
|
||||
/bincue
|
||||
/bincue
|
||||
/bincue.c
|
||||
/cdda
|
||||
/cdrdao
|
||||
/cdrdao.c
|
||||
/follow_symlink
|
||||
|
||||
@@ -24,6 +24,10 @@ bincue_SOURCES = helper.c bincue.c
|
||||
bincue_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
bincue_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
cdda_SOURCES = helper.c cdda.c
|
||||
cdda_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
cdda_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
cdrdao_SOURCES = helper.c cdrdao.c
|
||||
cdrdao_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
cdrdao_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
@@ -58,7 +62,7 @@ win32_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
win32_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
check_PROGRAMS = \
|
||||
abs_path bincue cdrdao freebsd gnu_linux \
|
||||
abs_path bincue cdda cdrdao freebsd gnu_linux \
|
||||
mmc_read mmc_write nrg \
|
||||
osx realpath solaris win32
|
||||
|
||||
|
||||
56
test/driver/cdda.c
Normal file
56
test/driver/cdda.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- C -*-
|
||||
Copyright (C) 2012 Rocky Bernstein <rocky@gnu.org>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
Unit test for cdda-like things lib/driver/disc.c
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "helper.h"
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
char *mcn = cdio_get_mcn(NULL);
|
||||
|
||||
cdio_log_set_handler(log_handler);
|
||||
cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
|
||||
|
||||
/* Had a bug in not testing for null p_cdio with cdio_get_mcn. */
|
||||
mcn = cdio_get_mcn(NULL);
|
||||
if (mcn != NULL) {
|
||||
printf("Should have gotten NULL for MCN for cdio object\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- C -*-
|
||||
Copyright (C) 2009, 2010 Rocky Bernstein <rocky@gnu.org>
|
||||
Copyright (C) 2009, 2010, 2012 Rocky Bernstein <rocky@gnu.org>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#define __CDIO_CONFIG_H__ 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
|
||||
Reference in New Issue
Block a user