Bug 24778 — throw_error() segfaults for daemon-internally called methods
authorMartin Pitt <martin.pitt@ubuntu.com>
Wed, 28 Oct 2009 21:16:09 +0000 (22:16 +0100)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 2 Nov 2009 15:55:46 +0000 (10:55 -0500)
commit2e65a351fe334417ca97973365f711a2a4eb0875
tree0f9b058707bc45d5019ceb0c96cb5681b65a3f2e
parent486854b826286aaaa94331cd80ed399354642b6b
Bug 24778 — throw_error() segfaults for daemon-internally called methods

Some functions like devkit_disks_device_drive_ata_smart_refresh_data() are used
internally by the daemon, in which case the DBusGMethodInvocation context is
NULL. If these methods throw an error (observed on "daemon is inhibited"), this
NULL context is propagated all the way down to throw_error, which previously
tried to call dbus_g_method_return_error() with a NULL context; there is no
D-Bus method call to terminate, so this caused a segfault.

Change throw_error() to just use g_warning() in this case, so that the error
appears on the daemon's stderr. This makes it generally safe to internally call
D-Bus exported methods.

Signed-off-by: David Zeuthen <davidz@redhat.com>
src/devkit-disks-daemon.c