• Simon McVittie's avatar
    _dbus_append_address_from_socket: Make control flow clearer · 1d85b229
    Simon McVittie authored
    In the current implementation, we can reach the "err" label either
    because we ran out of memory, or because we got a socket error from
    getsockname() or inet_ntop(), and we blindly assume that running out
    of memory will set ENOMEM.
    
    However, that isn't actually true: when we are simulating OOM in
    dbus_malloc(), the fake OOM doesn't set ENOMEM. Handle the OOM
    condition explicitly instead.
    
    In the AF_UNIX case, the break statement is no longer reached at all,
    so leave a comment there. In the AF_INET and AF_INET6 cases, if
    inet_ntop() fails, explicitly goto err instead of using break
    (this has the same practical effect) to make it clearer that we are
    going to the "socket error" code path.
    Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
    Reviewed-by: Ralf Habacker's avatarRalf Habacker <ralf.habacker@freenet.de>
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61922
    1d85b229
Name
Last commit
Last update
bus Loading commit data...
cmake Loading commit data...
dbus Loading commit data...
doc Loading commit data...
m4 Loading commit data...
test Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
ChangeLog Loading commit data...
ChangeLog.pre-1-0 Loading commit data...
ChangeLog.pre-1-2 Loading commit data...
Doxyfile.in Loading commit data...
HACKING Loading commit data...
INSTALL Loading commit data...
Makefile.am Loading commit data...
NEWS Loading commit data...
NEWS.pre-1-0 Loading commit data...
NEWS.pre-1-2 Loading commit data...
README Loading commit data...
README.cmake Loading commit data...
README.cygwin Loading commit data...
README.launchd Loading commit data...
README.valgrind Loading commit data...
README.win Loading commit data...
README.wince Loading commit data...
autogen.sh Loading commit data...
cleanup-man-pages.sh Loading commit data...
configure.ac Loading commit data...
dbus-1-uninstalled.pc.in Loading commit data...
dbus-1.pc.in Loading commit data...