Merge pull request 'that should fix the error printout' (#406) from bugfix_read_only_check into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #406 Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
commit
9556ce6d9f
@ -508,9 +508,9 @@ bool SdCardManager::isSdCardUsable(std::optional<sd::SdCard> sdCard) {
|
|||||||
ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) {
|
ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) {
|
||||||
std::ostringstream command;
|
std::ostringstream command;
|
||||||
if (sdcard == sd::SdCard::SLOT_0) {
|
if (sdcard == sd::SdCard::SLOT_0) {
|
||||||
command << "grep -q '" << config::SD_0_MOUNT_POINT << " ext4 ro,' /proc/mounts";
|
command << "grep -q '" << config::SD_0_MOUNT_POINT << " ext4 rw,' /proc/mounts";
|
||||||
} else if (sdcard == sd::SdCard::SLOT_1) {
|
} else if (sdcard == sd::SdCard::SLOT_1) {
|
||||||
command << "grep -q '" << config::SD_1_MOUNT_POINT << " ext4 ro,' /proc/mounts";
|
command << "grep -q '" << config::SD_1_MOUNT_POINT << " ext4 rw,' /proc/mounts";
|
||||||
} else {
|
} else {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
@ -519,18 +519,9 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = cmdExecutor.execute();
|
result = cmdExecutor.execute();
|
||||||
if (result != returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
int exitStatus = cmdExecutor.getLastError();
|
|
||||||
if (exitStatus == 1) {
|
|
||||||
readOnly = false;
|
|
||||||
return returnvalue::OK;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
auto& readVec = cmdExecutor.getReadVector();
|
|
||||||
size_t readLen = strnlen(readVec.data(), readVec.size());
|
|
||||||
if (readLen == 0) {
|
|
||||||
readOnly = false;
|
readOnly = false;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user