Replaced some large local variables by other means in xorriso/check_media.c

This commit is contained in:
Thomas Schmitt 2011-05-19 13:38:14 +00:00
parent c2513de0a2
commit ac0c9aeec6
2 changed files with 14 additions and 5 deletions

View File

@ -284,7 +284,11 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
{
int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip;
unsigned char *map;
unsigned char buf[1024];
unsigned char *buf;
buf= TSOB_FELD(unsigned char, 1024);
if(buf == NULL)
return(-1);
*os_errno= 0;
if(msg != NULL)
@ -296,7 +300,7 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
strcpy(msg, "Cannot open path ");
Text_shellsafe(path, msg+strlen(msg), 0);
}
return(0);
{ret= 0; goto ex;}
}
ret= read(fd, buf, 32);
if(ret < 32) {
@ -354,6 +358,8 @@ wrong_filetype:;
ex:;
if(fd != -1)
close(fd);
if(buf != NULL)
free(buf);
if(ret <= 0)
Sectorbitmap_destroy(o, 0);
return(ret);
@ -829,14 +835,16 @@ int Xorriso_check_media_list_job(struct XorrisO *xorriso,
char *report, int flag)
{
int all, ret;
char default_report[161], quality_name[80];
char *default_report= NULL, quality_name[80];
struct CheckmediajoB *dflt= NULL;
Xorriso_alloc_meM(default_report, char, 161);
all= !(flag&1);
report[0]= 0;
ret= Checkmediajob_new(&dflt, 0);
if(ret <= 0)
return(-1);
{ret= -1; goto ex;}
sprintf(report, "-check_media_defaults");
if(!all)
strcat(report, " reset=now");
@ -911,6 +919,7 @@ ex:;
Checkmediajob_destroy(&dflt, 0);
sprintf(default_report, "-check_media_defaults reset=now %s",
xorriso->list_delimiter);
Xorriso_free_meM(default_report);
if(ret > 0 && strcmp(report, default_report) == 0)
return(2);
return(ret);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.19.133735"
#define Xorriso_timestamP "2011.05.19.133840"