dbus/tools
Роман Донченко 3be6063729 Avoid killing all available processes if an X error arrives early on
The timeline of events in dbus-launch's main process goes something like this:

* do initial X calls
[1]
* do some other stuff
* fork
    (child process starts doing some other stuff)
* return "intermediate parent" pid from fork()
* obtain bus daemon pid from bus_pid_to_launcher_pipe
[2]
* do things that might include X11 calls or killing the dbus-daemon

Meanwhile, the "babysitter" child goes like this:

* return 0 from fork()
[3]
* obtain bus daemon pid from parent process via bus_pid_to_babysitter_pipe
[4]
* do things that might include X11 calls or killing the bus daemon

Before [1] or [3], the right thing to do about an X error is to just
exit. The current implementation called kill(-1) first, which is
undesirable: it kills unrelated processes. With this change, we
just exit.

After [2] or [4], the right thing to do is to kill the dbus-daemon,
and that's what the existing code did.

Between [1] and [2], or between [3] and [4], there is no correct thing
that we can do immediately: we would have to wait for the end of the
"critical section", *then* kill the dbus-daemon. This has not yet been
implemented, so this patch relies for its correctness on the fact that
there are no libX11 calls between those points, so we cannot receive
an X error between them.

dbus-launch deserves more comments, or a reimplementation that is easier to
understand, but this change is certainly better than nothing.

[Commit message added, summarizing reviewers' comments -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74698
Reviewed-by: Simon McVittie
Reviewed-by: Thiago Macieira
2014-04-30 19:11:56 +01:00
..
.gitignore Update .gitignore files 2014-03-06 13:10:56 +00:00
dbus-cleanup-sockets.c dbus-cleanup-sockets: free list of socket entries 2011-01-17 12:18:40 +00:00
dbus-launch-win.c Fixed compiler warning on windows. 2013-08-19 21:29:26 +02:00
dbus-launch-x11.c Fix spelling/grammatical mistakes detected by Debian's lintian(1) 2011-07-28 11:05:43 +01:00
dbus-launch.c Avoid killing all available processes if an X error arrives early on 2014-04-30 19:11:56 +01:00
dbus-launch.h Consistently include <config.h> in all C source files and never in header files. 2010-03-19 20:11:48 +01:00
dbus-monitor.c dbus-monitor: keep backwards compatibility 2013-10-09 11:26:46 +01:00
dbus-print-message.c Support printing unix file descriptors in dbus-send/dbus-monitor 2013-11-27 15:08:25 +00:00
dbus-print-message.h Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
dbus-run-session.c dbus-run-session: remove various extra variables from the environment 2013-08-23 11:41:16 +01:00
dbus-send.c dbus-send: replace --address with --peer and --bus. 2013-10-09 11:18:20 +01:00
dbus-uuidgen.c Bug 21161 - Update the FSF address 2009-07-14 15:39:47 -04:00
lcov.am Break up the monster conditional in config-parser so gcov can cope 2011-04-07 11:25:54 +01:00
Makefile.am dbus-run-session: remove various extra variables from the environment 2013-08-23 11:41:16 +01:00
run-with-tmp-session-bus.sh run-with-tmp-session-bus.sh: create a unique temporary file per process 2013-09-05 12:35:11 +01:00
strtoll.c Include config.h as the first thing in every .c file 2013-02-22 13:08:27 +00:00
strtoull.c Include config.h as the first thing in every .c file 2013-02-22 13:08:27 +00:00