X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fdetect-virt.c;h=79cad5d8ab5281f38402bdc4807040a17df66d01;hp=7685d18cc62b1376fdc2b92fd214dd2bcaee830c;hb=6bc1ce40e531257ae8dd9bbbbcb48e5de0a1187b;hpb=07faed4f99d0c798f92de3032b9c20ca31388494 diff --git a/src/detect-virt.c b/src/detect-virt.c index 7685d18cc..79cad5d8a 100644 --- a/src/detect-virt.c +++ b/src/detect-virt.c @@ -25,22 +25,24 @@ #include #include "util.h" +#include "virt.h" int main(int argc, char *argv[]) { - int r; + Virtualization r; const char *id; /* This is mostly intended to be used for scripts which want * to detect whether we are being run in a virtualized * environment or not */ - if ((r = detect_virtualization(&id)) < 0) { + r = detect_virtualization(&id); + if (r < 0) { log_error("Failed to check for virtualization: %s", strerror(-r)); return EXIT_FAILURE; } if (r > 0) - printf("%s\n", id); + puts(id); - return r == 0; + return r > 0 ? EXIT_SUCCESS : EXIT_FAILURE; }