mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-18 21:07:52 +00:00
Updated error handling
This commit is contained in:
parent
7f68f9b91f
commit
4ff271eeec
@ -707,12 +707,12 @@ string SetReservedIds(const list<string>& ids_to_reserve)
|
|||||||
|
|
||||||
bool CreateImage(int fd, const PbCommand& command)
|
bool CreateImage(int fd, const PbCommand& command)
|
||||||
{
|
{
|
||||||
if (command.params().size() < 2 || command.params().Get(0).empty() || command.params().Get(1).empty()) {
|
if (command.params().size() < 3 || command.params().Get(0).empty() || command.params().Get(1).empty()
|
||||||
return ReturnStatus(fd, false, "Can't create image file: Missing filename or file size");
|
|| command.params().Get(2).empty()) {
|
||||||
|
return ReturnStatus(fd, false, "Can't create image file: Missing filename, file size or permission");
|
||||||
}
|
}
|
||||||
|
|
||||||
int permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
int permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||||
if (command.params().size() > 2) {
|
|
||||||
const char *permission = command.params().Get(2).c_str();
|
const char *permission = command.params().Get(2).c_str();
|
||||||
if (strcasecmp(permission, "true") && strcasecmp(permission, "false")) {
|
if (strcasecmp(permission, "true") && strcasecmp(permission, "false")) {
|
||||||
return ReturnStatus(fd, false, "Invalid read-only setting '" + command.params().Get(2) + "'");
|
return ReturnStatus(fd, false, "Invalid read-only setting '" + command.params().Get(2) + "'");
|
||||||
@ -721,7 +721,6 @@ bool CreateImage(int fd, const PbCommand& command)
|
|||||||
if (!strcasecmp(permission, "true")) {
|
if (!strcasecmp(permission, "true")) {
|
||||||
permissions = S_IRUSR | S_IRGRP | S_IROTH;
|
permissions = S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
string filename = command.params().Get(0);
|
string filename = command.params().Get(0);
|
||||||
if (filename.find('/') != string::npos) {
|
if (filename.find('/') != string::npos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user