]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
[main] Handle OOM in reload watch
authorColin Walters <walters@verbum.org>
Tue, 16 Mar 2010 17:11:20 +0000 (13:11 -0400)
committerColin Walters <walters@verbum.org>
Tue, 16 Mar 2010 17:11:44 +0000 (13:11 -0400)
http://bugs.freedesktop.org/show_bug.cgi?id=12953

Wait for memory if we can't init the string.

Based on an original patch by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

bus/main.c

index 7f9e98f3a0be506c1bf4d043b76d116ef32fae9b..e3650f1b14cabe0f1a171a8c3b6b24cf6997cfdd 100644 (file)
@@ -156,7 +156,10 @@ handle_reload_watch (DBusWatch    *watch,
 {
   DBusError error;
   DBusString str;
-  _dbus_string_init (&str);
+
+  while (!_dbus_string_init (&str))
+    _dbus_wait_for_memory ();
+
   if ((reload_pipe[RELOAD_READ_END] > 0) &&
       _dbus_read_socket (reload_pipe[RELOAD_READ_END], &str, 1) != 1)
     {