mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix sysmerge(8) out of bounds accesses and error messages.
This commit is contained in:
parent
f28fc4ac39
commit
c195784736
1 changed files with 7 additions and 7 deletions
|
@ -120,21 +120,21 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
source = NULL;
|
source = NULL;
|
||||||
if ( 1 < argc )
|
if ( 1 < argc )
|
||||||
err(2, "Unexpected extra operand `%s'", argv[2]);
|
errx(2, "Unexpected extra operand `%s'", argv[1]);
|
||||||
}
|
}
|
||||||
else if ( booting )
|
else if ( booting )
|
||||||
{
|
{
|
||||||
source = "/sysmerge";
|
source = "/sysmerge";
|
||||||
if ( 1 < argc )
|
if ( 1 < argc )
|
||||||
err(2, "Unexpected extra operand `%s'", argv[2]);
|
errx(2, "Unexpected extra operand `%s'", argv[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( argc < 2 )
|
if ( argc < 2 )
|
||||||
err(2, "No source operand was given");
|
errx(2, "No source operand was given");
|
||||||
source = argv[1];
|
source = argv[1];
|
||||||
if ( 2 < argc )
|
if ( 2 < argc )
|
||||||
err(2, "Unexpected extra operand `%s'", argv[2]);
|
errx(2, "Unexpected extra operand `%s'", argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( booting )
|
if ( booting )
|
||||||
|
@ -216,11 +216,11 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
printf(" - Scheduling upgrade on next boot...\n");
|
printf(" - Scheduling upgrade on next boot...\n");
|
||||||
execute((const char*[]) { "cp", "/boot/sortix.bin",
|
execute((const char*[]) { "cp", "/boot/sortix.bin",
|
||||||
"/boot/sortix.bin.sysmerge.orig" }, "_e");
|
"/boot/sortix.bin.sysmerge.orig", NULL }, "_e");
|
||||||
execute((const char*[]) { "cp", "/boot/sortix.initrd",
|
execute((const char*[]) { "cp", "/boot/sortix.initrd",
|
||||||
"/boot/sortix.initrd.sysmerge.orig" }, "_e");
|
"/boot/sortix.initrd.sysmerge.orig", NULL }, "_e");
|
||||||
execute((const char*[]) { "cp", "/sysmerge/boot/sortix.bin",
|
execute((const char*[]) { "cp", "/sysmerge/boot/sortix.bin",
|
||||||
"/boot/sortix.bin" }, "_e");
|
"/boot/sortix.bin", NULL }, "_e");
|
||||||
execute((const char*[]) { "/sysmerge/sbin/update-initrd", NULL }, "_e");
|
execute((const char*[]) { "/sysmerge/sbin/update-initrd", NULL }, "_e");
|
||||||
|
|
||||||
printf("The system will be upgraded to %s on the next boot.\n",
|
printf("The system will be upgraded to %s on the next boot.\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue