Skip to content

Commit

Permalink
[sshfs] Address some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sploder12 committed Dec 17, 2024
1 parent c5c65a2 commit 17c2580
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/platform/platform_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <multipass/utils.h>

#include <grp.h>
#include <scope_guard.hpp>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
Expand Down Expand Up @@ -203,20 +202,20 @@ std::function<std::optional<int>(const std::function<bool()>&)> mp::platform::ma
});

Check warning on line 202 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L202

Added line #L202 was not covered by tests

// wait on signals and condition
int ret = SIGUSR2;
while (ret == SIGUSR2 && condition())
int latest_signal = SIGUSR2;
while (latest_signal == SIGUSR2 && condition())

Check warning on line 206 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L205-L206

Added lines #L205 - L206 were not covered by tests
{
// can't use sigtimedwait since macOS doesn't support it
sigwait(&sigset, &ret);
sigwait(&sigset, &latest_signal);

Check warning on line 209 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L209

Added line #L209 was not covered by tests
}

{
{ // set `sig` to something other than SIGUSR2 so `signaler` knows to exit
std::lock_guard lock(sig_mtx);
sig = ret == SIGUSR2 ? 0 : ret;
sig = latest_signal == SIGUSR2 ? 0 : latest_signal;

Check warning on line 214 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L213-L214

Added lines #L213 - L214 were not covered by tests
}
sig_cv.notify_all();

Check warning on line 216 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L216

Added line #L216 was not covered by tests

// if sig is SIGUSR2 then we know we're exiting because condition() was false
return ret == SIGUSR2 ? std::nullopt : std::make_optional(sig);
// if `sig` is 0 then we know we're exiting because condition() was false
return sig ? std::make_optional(sig) : std::nullopt;

Check warning on line 219 in src/platform/platform_unix.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/platform_unix.cpp#L219

Added line #L219 was not covered by tests
};
}

0 comments on commit 17c2580

Please sign in to comment.