X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fmain.c;h=4d4f6e8f4caf664f772406840213b6f73326c8e8;hb=39abcaee3e905f41efcb8b11ff4ff013f552620c;hp=f342cdd2895559c6a322d9cdc8e2f5a12f6a85dd;hpb=718db96199eb307751264e4163555662c9a389fa;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index f342cdd28..4d4f6e8f4 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -32,6 +32,10 @@ #include #include +#ifdef HAVE_VALGRIND_VALGRIND_H +#include +#endif + #include "sd-daemon.h" #include "sd-messages.h" #include "sd-bus.h" @@ -1830,6 +1834,15 @@ finish: if (fds) fdset_free(fds); +#ifdef HAVE_VALGRIND_VALGRIND_H + /* If we are PID 1 and running under valgrind, then let's exit + * here explicitly. valgrind will only generate nice output on + * exit(), not on exec(), hence let's do the former not the + * latter here. */ + if (getpid() == 1 && RUNNING_ON_VALGRIND) + return 0; +#endif + if (shutdown_verb) { const char * command_line[] = { SYSTEMD_SHUTDOWN_BINARY_PATH,