improve --test

This commit is contained in:
Laurent Vivier
2007-09-03 19:39:01 +00:00
parent 256925db92
commit d446f79fea

View File

@@ -364,7 +364,11 @@ static int add_file(char *configuration,
return 0; return 0;
} }
if (map_path == NULL) if ((action & ACTION_TEST) != 0)
{
map_path = tempnam(NULL, "emile-map_path-");
}
else if (map_path == NULL)
{ {
map_path = get_map_name(path); map_path = get_map_name(path);
if (map_path == NULL) if (map_path == NULL)
@@ -375,21 +379,18 @@ static int add_file(char *configuration,
/* get block mapping of kernel in filesystem */ /* get block mapping of kernel in filesystem */
if ((action & ACTION_TEST) == 0) container = emile_second_create_mapfile(&unit_id, map_path, path);
if (container == NULL)
{ {
container = emile_second_create_mapfile(&unit_id, map_path, path); free(map_path);
if (container == NULL) return -1;
{
free(map_path);
return -1;
}
sprintf(map_info,
"container:(sd%d)0x%x,0x%x", unit_id,
container->blocks[0].offset,
container->blocks[0].count);
} }
sprintf(map_info,
"container:(sd%d)0x%x,0x%x", unit_id,
container->blocks[0].offset,
container->blocks[0].count);
free(container); free(container);
if (verbose) if (verbose)
@@ -399,6 +400,9 @@ static int add_file(char *configuration,
"title", index, "title", index,
property, map_info); property, map_info);
if ((action & ACTION_TEST) != 0)
unlink(map_path);
free(map_path); free(map_path);
return 0; return 0;
} }
@@ -494,7 +498,7 @@ static char *set_config(emile_config *config, int drive)
} }
} while (!emile_config_read_next(config)); } while (!emile_config_read_next(config));
if ( ((action & ACTION_TEST) == 0) && (strlen(configuration) > 1023)) if (strlen(configuration) > 1023)
{ {
int fd; int fd;
char* bootconfig = "/boot/emile/.bootconfig"; char* bootconfig = "/boot/emile/.bootconfig";