Added root companion and logging macros

This commit is contained in:
snake-4
2024-04-16 17:49:25 +02:00
parent 2962997439
commit f200aa4561
6 changed files with 97 additions and 38 deletions

View File

@@ -7,6 +7,7 @@
#include "mount_parser.hpp"
#include "logging.hpp"
#include "utils.hpp"
mount_entry_t::mount_entry_t(::mntent *entry)
: fsname(entry->mnt_fsname), dir(entry->mnt_dir), type(entry->mnt_type), freq(entry->mnt_freq), passno(entry->mnt_passno)
@@ -25,12 +26,8 @@ std::vector<mount_entry_t> parseMountsFromPath(const char *path)
{
std::vector<mount_entry_t> result;
FILE *file = setmntent(path, "r");
if (file == NULL)
{
LOGE("setmntent(\"%s\", \"r\") returned NULL: %d (%s)", path, errno, strerror(errno));
return result;
}
FILE *file;
ASSERT_EXIT("parseMountsFromPath", (file = setmntent(path, "r")) != NULL, return result);
struct mntent *entry;
while ((entry = getmntent(file)) != NULL)