Set errno=0 before calling strtol(). bug #18131
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdchange.c,v 1.2 2006/01/24 00:53:19 rocky Exp $
|
$Id: cdchange.c,v 1.3 2007/03/05 11:18:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -50,6 +50,7 @@ main(int argc, const char *argv[])
|
|||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
p_cdio = cdio_open (argv[1], DRIVER_DEVICE);
|
p_cdio = cdio_open (argv[1], DRIVER_DEVICE);
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
|
errno = 0;
|
||||||
i_sleep = strtol(argv[2], (char **)NULL, 10);
|
i_sleep = strtol(argv[2], (char **)NULL, 10);
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
printf("Invalid sleep parameter %s\n", argv[2]);
|
printf("Invalid sleep parameter %s\n", argv[2]);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdrdao.c,v 1.21 2006/02/27 10:27:39 flameeyes Exp $
|
$Id: cdrdao.c,v 1.22 2007/03/05 11:18:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
toc reading routine adapted from cuetools
|
toc reading routine adapted from cuetools
|
||||||
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
|
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.21 2006/02/27 10:27:39 flameeyes Exp $";
|
static const char _rcsid[] = "$Id: cdrdao.c,v 1.22 2007/03/05 11:18:49 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -758,6 +758,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
|||||||
if ( psz_field[0] == '#') {
|
if ( psz_field[0] == '#') {
|
||||||
long int offset;
|
long int offset;
|
||||||
psz_field++;
|
psz_field++;
|
||||||
|
errno = 0;
|
||||||
offset = strtol(psz_field, (char **)NULL, 10);
|
offset = strtol(psz_field, (char **)NULL, 10);
|
||||||
if ( 0 != errno ) {
|
if ( 0 != errno ) {
|
||||||
cdio_log (log_level,
|
cdio_log (log_level,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.c,v 1.27 2006/09/26 18:07:59 flameeyes Exp $
|
$Id: iso9660.c,v 1.28 2007/03/05 11:18:49 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 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2003, 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -54,7 +54,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.27 2006/09/26 18:07:59 flameeyes Exp $";
|
static const char _rcsid[] = "$Id: iso9660.c,v 1.28 2007/03/05 11:18:49 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;
|
||||||
@@ -169,6 +169,7 @@ iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool b_localtime,
|
|||||||
char num[10]; \
|
char num[10]; \
|
||||||
memcpy(num, p_ldate->LT_FIELD, sizeof(p_ldate->LT_FIELD)); \
|
memcpy(num, p_ldate->LT_FIELD, sizeof(p_ldate->LT_FIELD)); \
|
||||||
num[sizeof(p_ldate->LT_FIELD)+1] = '\0'; \
|
num[sizeof(p_ldate->LT_FIELD)+1] = '\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; \
|
if (0 != errno) return false; \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
* Copyright (C) 2004, 2005, 2006, 2007 Rocky Bernstein <rocky@gnu.org>
|
||||||
* (C) 1998 Monty <xiphmont@mit.edu>
|
* (C) 1998 Monty <xiphmont@mit.edu>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -652,6 +652,7 @@ get_int_arg(char c, long int *pi_arg)
|
|||||||
" but not found. Option ignored\n", c);
|
" but not found. Option ignored\n", c);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
i_arg = strtol(optarg, &p_end, 10);
|
i_arg = strtol(optarg, &p_end, 10);
|
||||||
if (errno == ERANGE) {
|
if (errno == ERANGE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|||||||
Reference in New Issue
Block a user