Skip to content

Commit

Permalink
Fix osquery exit with wrong status
Browse files Browse the repository at this point in the history
Summary:
osquery returned status 1(error) always when osqueryd service install uninstall was requested by the flags.
Even if install/uninstall was successfull.

Add extra logging in case of success.
Exit with status 0 when successfully installed/uninstalled

Reviewed By: jessek

Differential Revision: D14622771

fbshipit-source-id: c0c7569a2b13434e2ad28ba92cba308024b044ec
  • Loading branch information
George Guliashvili authored and facebook-github-bot committed Mar 26, 2019
1 parent 85eb77a commit 3824c2e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions osquery/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,21 @@ int startOsquery(int argc, char* argv[], std::function<void()> shutdown) {

if (FLAGS_install) {
auto binPath = fs::system_complete(fs::path(argv[0]));
if (!installService(binPath.string())) {
if (installService(binPath.string())) {
LOG(INFO) << "osqueryd service was installed successfully.";
return 0;
} else {
LOG(ERROR) << "Unable to install the osqueryd service";
return 1;
}
return 1;
} else if (FLAGS_uninstall) {
if (!uninstallService()) {
if (uninstallService()) {
LOG(INFO) << "osqueryd service was uninstalled successfully.";
return 0;
} else {
LOG(ERROR) << "Unable to uninstall the osqueryd service";
return 1;
}
return 1;
}

runner.installShutdown(shutdown);
Expand Down

0 comments on commit 3824c2e

Please sign in to comment.