diff options
author | Havoc Pennington <hp@redhat.com> | 2007-06-15 19:28:36 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2007-06-15 19:28:36 +0000 |
commit | 43b944a0a6ea48e8a8b06ae3e638299f591cde8d (patch) | |
tree | 0b7dc627144289e0a7cbb08546e1aee9fc07cdf3 /dbus/dbus-transport-socket.c | |
parent | 283b1c6fc775c15773ebdddd423f79ad1612233d (diff) |
2007-06-15 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.c (_dbus_set_errno_to_zero)
(_dbus_get_is_errno_nonzero, _dbus_get_is_errno_eintr)
(_dbus_strerror_from_errno): family of functions to abstract
errno, though these are somewhat bogus (really we should make our
socket wrappers not use errno probably - the issue is that any
usage of errno that isn't socket-related probably is not
cross-platform, so should either be in a unix-only file that can
use errno directly, or is a bug - these general errno wrappers
hide issues of this nature in non-socket code, while
socket-specific API changes would not since sockets are allowed
cross-platform)
Diffstat (limited to 'dbus/dbus-transport-socket.c')
-rw-r--r-- | dbus/dbus-transport-socket.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 3f8c94d5..31a41e1f 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -267,17 +267,16 @@ read_data_into_auth (DBusTransport *transport, { /* EINTR already handled for us */ - if (errno == ENOMEM) + if (_dbus_get_is_errno_enomem ()) { *oom = TRUE; } - else if (errno == EAGAIN || - errno == EWOULDBLOCK) + else if (_dbus_get_is_errno_eagain_or_ewouldblock ()) ; /* do nothing, just return FALSE below */ else { _dbus_verbose ("Error reading from remote app: %s\n", - _dbus_strerror (errno)); + _dbus_strerror_from_errno ()); do_io_error (transport); } @@ -319,13 +318,12 @@ write_data_from_auth (DBusTransport *transport) { /* EINTR already handled for us */ - if (errno == EAGAIN || - errno == EWOULDBLOCK) + if (_dbus_get_is_errno_eagain_or_ewouldblock ()) ; else { _dbus_verbose ("Error writing to remote app: %s\n", - _dbus_strerror (errno)); + _dbus_strerror_from_errno ()); do_io_error (transport); } } @@ -613,13 +611,12 @@ do_writing (DBusTransport *transport) { /* EINTR already handled for us */ - if (errno == EAGAIN || - errno == EWOULDBLOCK) + if (_dbus_get_is_errno_eagain_or_ewouldblock ()) goto out; else { _dbus_verbose ("Error writing to remote app: %s\n", - _dbus_strerror (errno)); + _dbus_strerror_from_errno ()); do_io_error (transport); goto out; } @@ -749,19 +746,18 @@ do_reading (DBusTransport *transport) { /* EINTR already handled for us */ - if (errno == ENOMEM) + if (_dbus_get_is_errno_enomem ()) { _dbus_verbose ("Out of memory in read()/do_reading()\n"); oom = TRUE; goto out; } - else if (errno == EAGAIN || - errno == EWOULDBLOCK) + else if (_dbus_get_is_errno_eagain_or_ewouldblock ()) goto out; else { _dbus_verbose ("Error reading from remote app: %s\n", - _dbus_strerror (errno)); + _dbus_strerror_from_errno ()); do_io_error (transport); goto out; } @@ -1038,7 +1034,7 @@ socket_do_iteration (DBusTransport *transport, again: poll_res = _dbus_poll (&poll_fd, 1, poll_timeout); - if (poll_res < 0 && errno == EINTR) + if (poll_res < 0 && _dbus_get_is_errno_eintr ()) goto again; if (flags & DBUS_ITERATION_BLOCK) @@ -1081,7 +1077,7 @@ socket_do_iteration (DBusTransport *transport, else { _dbus_verbose ("Error from _dbus_poll(): %s\n", - _dbus_strerror (errno)); + _dbus_strerror_from_errno ()); } } |