Add missing checks to oxfstool
This commit is contained in:
parent
16e0fddaca
commit
a2cf756f4a
8
deps/ox/src/ox/fs/oxfstool.cpp
vendored
8
deps/ox/src/ox/fs/oxfstool.cpp
vendored
@ -248,9 +248,6 @@ int compact(int argc, char **args) {
|
|||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
fs->resize();
|
fs->resize();
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Invalid file system.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// write back to file
|
// write back to file
|
||||||
auto fsFile = fopen(fsPath, "wb");
|
auto fsFile = fopen(fsPath, "wb");
|
||||||
@ -265,6 +262,9 @@ int compact(int argc, char **args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete fs;
|
delete fs;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Invalid file system.\n");
|
||||||
|
}
|
||||||
delete []fsBuff;
|
delete []fsBuff;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Could not open file: %s\n", fsPath);
|
fprintf(stderr, "Could not open file: %s\n", fsPath);
|
||||||
@ -321,6 +321,7 @@ int remove(int argc, char **args) {
|
|||||||
int walk(int argc, char **args) {
|
int walk(int argc, char **args) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
size_t fsSize;
|
size_t fsSize;
|
||||||
|
if (argc >= 2) {
|
||||||
auto fsPath = args[2];
|
auto fsPath = args[2];
|
||||||
auto fsBuff = loadFileBuff(fsPath, &fsSize);
|
auto fsBuff = loadFileBuff(fsPath, &fsSize);
|
||||||
if (fsBuff) {
|
if (fsBuff) {
|
||||||
@ -350,6 +351,7 @@ int walk(int argc, char **args) {
|
|||||||
} else {
|
} else {
|
||||||
err = 2;
|
err = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user