Our abstract socket names look like filenames (/tmp/dbus-MwozdykBNK or
whatever), so if we incorrectly unlink the abstract socket name, in
highly unlikely circumstances we could accidentally unlink a non-abstract
socket belonging to another process!
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
goto failed_0;
}
- path_copy = _dbus_strdup (path);
- if (path_copy == NULL)
+ if (abstract)
{
- dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- goto failed_0;
+ path_copy = NULL;
+ }
+ else
+ {
+ path_copy = _dbus_strdup (path);
+ if (path_copy == NULL)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed_0;
+ }
}
listen_fd = _dbus_listen_unix_socket (path, abstract, error);
goto failed_2;
}
- _dbus_server_socket_own_filename(server, path_copy);
+ if (path_copy != NULL)
+ _dbus_server_socket_own_filename(server, path_copy);
_dbus_string_free (&address);