catch-toplevel-gen-skel-errors
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 24 Apr 2025 12:04:37 +0000 (14:04 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 24 Apr 2025 12:04:37 +0000 (14:04 +0200)
Change-Id: Id7cbb1632d22cde8dfb5bca1c05e209a9dfb8338

src/service/src/main_restore.cpp
src/service/src/main_skel.cpp

index 1761c294023b29e7e4e403143698fad31b28b426..70fdfcfc08b6b87f970e13e68cd53d08dbcfe86c 100644 (file)
@@ -38,7 +38,7 @@
 #include <utility>
 
 #undef LOG_TAG
-#define LOG_TAG "SESSIOND"
+#define LOG_TAG "SESSIOND_RESTORE_ONLY"
 #include <dlog.h>
 
 using namespace std::string_literals;
index 1c7adf502c7a0f128b80276821beccd7219034d5..d0f66d5fc9c062b16637361a1b02a88d0161b411 100644 (file)
@@ -1,6 +1,10 @@
 #include <filesystem>
 #include <iostream>
 
+#undef LOG_TAG
+#define LOG_TAG "SESSIOND_REGENERATE_SKEL"
+#include <dlog.h>
+
 #include "fs_helpers.hpp"
 #include "os_ops.hpp"
 #include "dir_backend_fixed_size.hpp"
@@ -28,7 +32,12 @@ int regenerate_skel() {
                const auto &username = entry.path().filename();
                const int username_uid = OS::get_uid_from_name(username.string());
 
-               add_user_subsession(username_uid, ".template", DirBackendAddFixedSize {template_img_size_kb});
+               try {
+                       add_user_subsession_inner(username_uid, ".template", DirBackendAddFixedSize {template_img_size_kb});
+               } catch (std::exception& ex) {
+                       LOGW("Unable to generate skel template for username %s (uid %d): %s", username, username_uid, ex.what());
+                       continue;
+               }
        }
 
        return r;