Better strtol fix based on SMS's remark.
This commit is contained in:
@@ -19,7 +19,7 @@ define(RELEASE_NUM, 79cvs)
|
|||||||
define(CDIO_VERSION_STR, 0.$1)
|
define(CDIO_VERSION_STR, 0.$1)
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
AC_REVISION([$Id: configure.ac,v 1.207 2006/12/14 00:19:58 rocky Exp $])dnl
|
AC_REVISION([$Id: configure.ac,v 1.208 2007/03/05 11:49:24 rocky Exp $])dnl
|
||||||
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ AC_DEFINE(LIBCDIO_CONFIG_H, 1,
|
|||||||
dnl headers
|
dnl headers
|
||||||
|
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(errno.h fcntl.h glob.h pwd.h)
|
AC_CHECK_HEADERS(errno.h fcntl.h glob.h limits.h pwd.h)
|
||||||
AC_CHECK_HEADERS(stdarg.h stdbool.h stdio.h sys/cdio.h sys/param.h)
|
AC_CHECK_HEADERS(stdarg.h stdbool.h stdio.h sys/cdio.h sys/param.h)
|
||||||
AC_CHECK_HEADERS(sys/time.h sys/timeb.h)
|
AC_CHECK_HEADERS(sys/time.h sys/timeb.h)
|
||||||
AC_CHECK_HEADERS(ncurses.h curses.h, break, [enable_cdda_player='no'])
|
AC_CHECK_HEADERS(ncurses.h curses.h, break, [enable_cdda_player='no'])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdchange.c,v 1.3 2007/03/05 11:18:49 rocky Exp $
|
$Id: cdchange.c,v 1.4 2007/03/05 11:49:24 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
@@ -24,6 +24,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -52,7 +56,7 @@ main(int argc, const char *argv[])
|
|||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
i_sleep = strtol(argv[2], (char **)NULL, 10);
|
i_sleep = strtol(argv[2], (char **)NULL, 10);
|
||||||
if (errno != 0) {
|
if ( (LONG_MIN == i_sleep || LONG_MAX == i_sleep && Lerrno != 0) ) {
|
||||||
printf("Invalid sleep parameter %s\n", argv[2]);
|
printf("Invalid sleep parameter %s\n", argv[2]);
|
||||||
printf("Error reported back from strtol: %s\n", strerror(errno));
|
printf("Error reported back from strtol: %s\n", strerror(errno));
|
||||||
return 2;
|
return 2;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdrdao.c,v 1.22 2007/03/05 11:18:49 rocky Exp $
|
$Id: cdrdao.c,v 1.23 2007/03/05 11:49:24 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
toc reading routine adapted from cuetools
|
toc reading routine adapted from cuetools
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.22 2007/03/05 11:18:49 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdrdao.c,v 1.23 2007/03/05 11:49:24 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -36,6 +36,9 @@ static const char _rcsid[] = "$Id: cdrdao.c,v 1.22 2007/03/05 11:18:49 rocky Exp
|
|||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
#include <cdio/version.h>
|
#include <cdio/version.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -760,7 +763,8 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
|||||||
psz_field++;
|
psz_field++;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
offset = strtol(psz_field, (char **)NULL, 10);
|
offset = strtol(psz_field, (char **)NULL, 10);
|
||||||
if ( 0 != errno ) {
|
if ( (LONG_MIN == offset || LONG_MAX == offset)
|
||||||
|
&& 0 != errno ) {
|
||||||
cdio_log (log_level,
|
cdio_log (log_level,
|
||||||
"%s line %d: can't convert `%s' to byte offset",
|
"%s line %d: can't convert `%s' to byte offset",
|
||||||
psz_cue_name, i_line, psz_field);
|
psz_cue_name, i_line, psz_field);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.c,v 1.28 2007/03/05 11:18:49 rocky Exp $
|
$Id: iso9660.c,v 1.29 2007/03/05 11:49:24 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2003, 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
@@ -43,6 +43,9 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
|
|||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -54,7 +57,7 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: iso9660.c,v 1.28 2007/03/05 11:18:49 rocky Exp $";
|
static const char _rcsid[] = "$Id: iso9660.c,v 1.29 2007/03/05 11:49:24 rocky Exp $";
|
||||||
|
|
||||||
/* Variables to hold debugger-helping enumerations */
|
/* Variables to hold debugger-helping enumerations */
|
||||||
enum iso_enum1_s iso_enums1;
|
enum iso_enum1_s iso_enums1;
|
||||||
@@ -172,7 +175,9 @@ iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool b_localtime,
|
|||||||
errno = 0; \
|
errno = 0; \
|
||||||
p_tm->TM_FIELD = strtol(num, \
|
p_tm->TM_FIELD = strtol(num, \
|
||||||
(char **)NULL, 10)+ADD_CONSTANT; \
|
(char **)NULL, 10)+ADD_CONSTANT; \
|
||||||
if (0 != errno) return false; \
|
errno = 0; \
|
||||||
|
if ((LONG_MIN==p_tm->TM_FIELD || LONG_MAX==p_tm->TM_FIELD) && \
|
||||||
|
0 != errno) return false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -61,6 +61,10 @@
|
|||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -654,7 +658,7 @@ get_int_arg(char c, long int *pi_arg)
|
|||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
i_arg = strtol(optarg, &p_end, 10);
|
i_arg = strtol(optarg, &p_end, 10);
|
||||||
if (errno == ERANGE) {
|
if ( (LONG_MIN == i_arg || LONG_MAX == i_arg) && (0 != errno) ) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Value '%s' for option -%c out of range. Value %ld "
|
"Value '%s' for option -%c out of range. Value %ld "
|
||||||
"used instead.\n", optarg, c, i_arg);
|
"used instead.\n", optarg, c, i_arg);
|
||||||
|
|||||||
Reference in New Issue
Block a user