diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-08-15 15:32:01 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-10-13 17:20:32 +0100 |
commit | 1699d16018a9ea647258b0b4730e55fa28710a53 (patch) | |
tree | 40dcc583aa19d77a7eacd25d493233d583fe70cf /dbus/dbus-server.c | |
parent | e82ec99e9232f2b05066f27559f499f2f2234f45 (diff) | |
download | dbus-1699d16018a9ea647258b0b4730e55fa28710a53.tar.gz |
Reimplement _dbus_warn_return_if_fail without -Wformat-nonliteral
We can avoid duplicating the format string between translation units,
without the compiler warning us that it can't check non-literal
format strings for format-string security vulnerabilities based on %p,
by breaking out the "assertion failed" case into a slow-path.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thomas Zimmermann <tdz@users.sourceforge.net>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97357
Diffstat (limited to 'dbus/dbus-server.c')
-rw-r--r-- | dbus/dbus-server.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c index 3adbd828..ea9aff2d 100644 --- a/dbus/dbus-server.c +++ b/dbus/dbus-server.c @@ -704,9 +704,8 @@ dbus_server_ref (DBusServer *server) if (_DBUS_UNLIKELY (old_refcount <= 0)) { _dbus_atomic_dec (&server->refcount); - _dbus_warn_check_failed (_dbus_return_if_fail_warning_format, - _DBUS_FUNCTION_NAME, "old_refcount > 0", - __FILE__, __LINE__); + _dbus_warn_return_if_fail (_DBUS_FUNCTION_NAME, "old_refcount > 0", + __FILE__, __LINE__); return NULL; } #endif @@ -746,9 +745,8 @@ dbus_server_unref (DBusServer *server) * Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303 */ _dbus_atomic_inc (&server->refcount); - _dbus_warn_check_failed (_dbus_return_if_fail_warning_format, - _DBUS_FUNCTION_NAME, "old_refcount > 0", - __FILE__, __LINE__); + _dbus_warn_return_if_fail (_DBUS_FUNCTION_NAME, "old_refcount > 0", + __FILE__, __LINE__); return; } #endif |