From: Eric Gillespie Date: Mon, 22 Dec 2025 15:21:40 +0000 (-0600) Subject: tidy 'create --command' failure handling X-Git-Tag: v0.13.1~55^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1076%2Fhead;p=thirdparty%2Fsnapper.git tidy 'create --command' failure handling Throw Exception in the case the child was STOPped or CONTinued. Document that system(3) should handle those cases. --- diff --git a/client/snapper/cmd-create.cc b/client/snapper/cmd-create.cc index 40cde60d..51f9e290 100644 --- a/client/snapper/cmd-create.cc +++ b/client/snapper/cmd-create.cc @@ -23,6 +23,7 @@ #include +#include #include #include @@ -208,8 +209,13 @@ namespace snapper if (exit_status != 0) { SN_THROW(CommandException(exit_status)); } - } else { + } else if (WIFSIGNALED(status)) { SN_THROW(Exception(sformat("%s killed with %d", command.c_str(), WTERMSIG(status)))); + } else { + // For system(3), only WIFEXITED or WIFSIGNALED should be possible. + string error = sformat(_("%s got STOP or CONT signal and may still be running"), + command.c_str()); + SN_THROW(Exception(error)); } } break; }