mirror of
https://github.com/vivier/EMILE.git
synced 2024-10-10 16:23:42 +00:00
correct restore and backup parameters
This commit is contained in:
parent
3c95e71ca8
commit
45201900ef
@ -116,6 +116,8 @@ static int open_map_of( char *dev_name, int flags,
|
|||||||
sprintf(disk_name, "%s%c", driver, 'a' + disk);
|
sprintf(disk_name, "%s%c", driver, 'a' + disk);
|
||||||
|
|
||||||
*map = emile_map_open(disk_name, flags);
|
*map = emile_map_open(disk_name, flags);
|
||||||
|
if (*map == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -258,7 +260,7 @@ static int restore_bootblock(char *dev_name, char *filename)
|
|||||||
|
|
||||||
/* write bootblock */
|
/* write bootblock */
|
||||||
|
|
||||||
ret = open_map_of(dev_name, O_WRONLY, &map, &partition);
|
ret = open_map_of(dev_name, O_RDWR, &map, &partition);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -464,7 +466,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
sprintf(dev_name, "%s%c%d", driver, disk + 'a', partnb);
|
sprintf(dev_name, "%s%c", driver, disk + 'a');
|
||||||
|
|
||||||
/* ROM boots on the first HFS partition it finds */
|
/* ROM boots on the first HFS partition it finds */
|
||||||
|
|
||||||
@ -527,7 +529,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (action & ACTION_RESTORE)
|
if (action & ACTION_RESTORE)
|
||||||
{
|
{
|
||||||
if (action & (ACTION_RESTORE | ACTION_PARTITION))
|
if (action & ~(ACTION_RESTORE | ACTION_PARTITION))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ERROR: \"--restore\" cannot be used with other arguments\n");
|
"ERROR: \"--restore\" cannot be used with other arguments\n");
|
||||||
@ -621,7 +623,7 @@ int main(int argc, char **argv)
|
|||||||
if ((action & ACTION_TEST) == 0)
|
if ((action & ACTION_TEST) == 0)
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
if ( (ret == 0) && (action & ACTION_BACKUP) )
|
if ( (ret == 0) && ((action & ACTION_BACKUP) == 0) )
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ERROR: there is already a bootblock on \"%s\"\n", partition);
|
"ERROR: there is already a bootblock on \"%s\"\n", partition);
|
||||||
|
Loading…
Reference in New Issue
Block a user