Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix compiler warn

Zack Bartel97d6a61508aa
diff --git a/src/core/src/client.cpp b/src/core/src/client.cpp
index dbe98f8..03851be 100644
--- a/src/core/src/client.cpp
+++ b/src/core/src/client.cpp
@@ -78,9 +78,9 @@ int Client::connect_unix(bool retry) {
std::string daemon_path = (self_path.parent_path() / "tetherd").string();
if (fork() == 0) {
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
- freopen("/dev/null", "r", stdin);
+ if (freopen("/dev/null", "w", stdout) == nullptr) {}
+ if (freopen("/dev/null", "w", stderr) == nullptr) {}
+ if (freopen("/dev/null", "r", stdin) == nullptr) {}
execl(daemon_path.c_str(), "tetherd", nullptr);
execlp("tetherd", "tetherd", nullptr);
diff --git a/src/gtk/main.cpp b/src/gtk/main.cpp
index 168f4fc..e6aa08d 100644
--- a/src/gtk/main.cpp
+++ b/src/gtk/main.cpp
@@ -613,9 +613,9 @@ namespace {
std::filesystem::path self_path = std::filesystem::read_symlink("/proc/self/exe");
std::string daemon_path = (self_path.parent_path() / "tetherd").string();
if (fork() == 0) {
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
- freopen("/dev/null", "r", stdin);
+ if (freopen("/dev/null", "w", stdout) == nullptr) {}
+ if (freopen("/dev/null", "w", stderr) == nullptr) {}
+ if (freopen("/dev/null", "r", stdin) == nullptr) {}
execl(daemon_path.c_str(), "tetherd", nullptr);
execlp("tetherd", "tetherd", nullptr);
exit(1);