macos fixs
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "comm/packet/packet_client.hpp"
|
#include "comm/packet/packet_client.hpp"
|
||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
#include "events/event_system.hpp"
|
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
@@ -448,8 +448,7 @@ auto fuse_base::mount(std::vector<std::string> args) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repertory::project_cleanup();
|
repertory::project_cleanup();
|
||||||
exit(utils::create_daemon(main_func));
|
return utils::create_daemon(main_func);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fuse_base::open_(const char *path, struct fuse_file_info *f_info) -> int {
|
auto fuse_base::open_(const char *path, struct fuse_file_info *f_info) -> int {
|
||||||
|
@@ -137,9 +137,10 @@ auto remote_fuse_drive::fgetattr_impl(std::string api_path, struct stat *u_stat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
api_error remote_fuse_drive::fsetattr_x_impl(std::string api_path,
|
auto remote_fuse_drive::fsetattr_x_impl(std::string api_path,
|
||||||
struct setattr_x *attr,
|
struct setattr_x *attr,
|
||||||
struct fuse_file_info *f_info) {
|
struct fuse_file_info *f_info)
|
||||||
|
-> api_error {
|
||||||
remote::setattr_x attributes{};
|
remote::setattr_x attributes{};
|
||||||
attributes.valid = attr->valid;
|
attributes.valid = attr->valid;
|
||||||
attributes.mode = attr->mode;
|
attributes.mode = attr->mode;
|
||||||
|
@@ -230,19 +230,21 @@ auto create_daemon(std::function<int()> main_func) -> int {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid > 0) {
|
||||||
signal(SIGCHLD, SIG_DFL);
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (setsid() < 0) {
|
if (setsid() < 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto second_pid = fork();
|
pid = fork();
|
||||||
if (second_pid < 0) {
|
if (pid < 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (second_pid > 0) {
|
if (pid > 0) {
|
||||||
exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
@@ -262,13 +264,14 @@ auto create_daemon(std::function<int()> main_func) -> int {
|
|||||||
close(file_desc);
|
close(file_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal(SIGCHLD, SIG_DFL);
|
||||||
|
signal(SIGHUP, SIG_DFL);
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
umask(0);
|
umask(0);
|
||||||
chdir("/");
|
chdir("/");
|
||||||
return main_func();
|
|
||||||
}
|
|
||||||
|
|
||||||
signal(SIGCHLD, SIG_IGN);
|
return main_func();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
} // namespace repertory::utils
|
} // namespace repertory::utils
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#define REPERTORY_INCLUDE_CLI_MOUNT_HPP_
|
#define REPERTORY_INCLUDE_CLI_MOUNT_HPP_
|
||||||
|
|
||||||
#include "cli/common.hpp"
|
#include "cli/common.hpp"
|
||||||
|
#include "initialize.hpp"
|
||||||
|
|
||||||
namespace repertory::cli::actions {
|
namespace repertory::cli::actions {
|
||||||
[[nodiscard]] inline auto
|
[[nodiscard]] inline auto
|
||||||
@@ -121,13 +122,12 @@ mount(std::vector<const char *> args, std::string data_directory,
|
|||||||
<< " Drive" << std::endl;
|
<< " Drive" << std::endl;
|
||||||
if (prov == provider_type::remote) {
|
if (prov == provider_type::remote) {
|
||||||
try {
|
try {
|
||||||
constexpr const std::uint8_t retry_count{30U};
|
|
||||||
|
|
||||||
auto remote_cfg = config.get_remote_config();
|
auto remote_cfg = config.get_remote_config();
|
||||||
remote_cfg.host_name_or_ip = remote_host;
|
remote_cfg.host_name_or_ip = remote_host;
|
||||||
remote_cfg.api_port = remote_port;
|
remote_cfg.api_port = remote_port;
|
||||||
config.set_remote_config(remote_cfg);
|
config.set_remote_config(remote_cfg);
|
||||||
|
|
||||||
|
constexpr const std::uint8_t retry_count{30U};
|
||||||
std::cout << "Connecting to remote [" << remote_host << ':' << remote_port
|
std::cout << "Connecting to remote [" << remote_host << ':' << remote_port
|
||||||
<< "] ..." << std::flush;
|
<< "] ..." << std::flush;
|
||||||
auto online{false};
|
auto online{false};
|
||||||
|
@@ -760,11 +760,11 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
|
|||||||
}
|
}
|
||||||
exec_args.push_back(nullptr);
|
exec_args.push_back(nullptr);
|
||||||
|
|
||||||
exit(utils::create_daemon([&]() -> int {
|
[[maybe_unused]] auto ret = utils::create_daemon([&]() -> int {
|
||||||
chdir(utils::path::get_parent_path(repertory_binary_).c_str());
|
chdir(utils::path::get_parent_path(repertory_binary_).c_str());
|
||||||
return execvp(exec_args.at(0U),
|
return execvp(exec_args.at(0U),
|
||||||
const_cast<char *const *>(exec_args.data()));
|
const_cast<char *const *>(exec_args.data()));
|
||||||
}));
|
});
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
Reference in New Issue
Block a user