#include "os_ops.hpp"
+#include <cassert>
#include <optional>
#include <vector>
#include <string_view>
#include <sys/wait.h>
#include <unistd.h>
+#undef LOG_TAG
+#define LOG_TAG "SESSIOND"
+#include <dlog.h>
+
namespace fs = std::filesystem;
using namespace std::literals;
std::string size_arg = std::to_string(size_kB);
- execl
+ const auto r = execl
( mkfs.data(), mkfs.data() /* argv[0] convention */
, "-F" /* dangerous, but needed for old mkfs.ext4 */
, "-E", owner_arg.c_str()
, (char *) NULL
);
+ LOGE("Failed to execute `%s -E %s %s %s`: %m"
+ , mkfs.data()
+ , owner_arg.c_str()
+ , image_path.c_str()
+ , size_arg.c_str()
+ );
+ assert(r == -1);
+
_exit(1);
} else {
try {
if (child_pid == 0) {
const auto umount_exe = "/usr/bin/umount"sv;
- execl
+ const auto r = execl
( umount_exe.data(), umount_exe.data() /* argv[0] convention */
, path.c_str()
, (char *) NULL
);
+ LOGE("Failed to execute `%s %s`: %m"
+ , umount_exe.data()
+ , path.c_str()
+ );
+ assert(r == -1);
+
_exit(1);
} else {
OS::throw_if_child_failed(child_pid, "umount failed!");
if (child_pid == 0) {
const auto mount_exe = "/usr/bin/mount"sv;
- execl
+ const auto r = execl
( mount_exe.data(), mount_exe.data() /* argv[0] convention */
, "-o", "loop"
, image_path.c_str()
, (char *) NULL
);
+ LOGE("Failed to execute `%s %s %s`: %m"
+ , mount_exe.data()
+ , image_path.c_str()
+ , mount_path.c_str()
+ );
+ assert(r == -1);
+
_exit(1);
} else {
OS::throw_if_child_failed(child_pid, "mount failed!");