mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-30 20:00:11 +01:00
2006-09-16 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps-unix.h: small change to Peter's patch to make dbus-sysdeps-unix-util.c build, add unix-specific sysdeps header. * dbus/dbus-sysdeps.h, dbus-sysdeps-unix.c: patch from Peter Kümmel bug #8249 to make the sysdeps.h read/write/open/close functions specifically for sockets only, and move generic read/write/open/close into unix-specific code.
This commit is contained in:
parent
e24dec0a89
commit
08079a5bde
11 changed files with 166 additions and 85 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
2006-09-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* dbus/dbus-sysdeps-unix.h: small change to Peter's patch to make
|
||||
dbus-sysdeps-unix-util.c build, add unix-specific sysdeps header.
|
||||
|
||||
* dbus/dbus-sysdeps.h, dbus-sysdeps-unix.c: patch from Peter
|
||||
Kümmel bug #8249 to make the sysdeps.h read/write/open/close
|
||||
functions specifically for sockets only, and move generic
|
||||
read/write/open/close into unix-specific code.
|
||||
|
||||
2006-09-14 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* dbus/dbus-transport-unix.c (unix_do_iteration): fix a valgrind
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ bus_context_new (const DBusString *config_file,
|
|||
}
|
||||
|
||||
bytes = _dbus_string_get_length (&addr);
|
||||
if (_dbus_write (print_addr_fd, &addr, 0, bytes) != bytes)
|
||||
if (_dbus_write_socket (print_addr_fd, &addr, 0, bytes) != bytes)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_FAILED,
|
||||
"Printing message bus address: %s\n",
|
||||
|
|
@ -640,7 +640,7 @@ bus_context_new (const DBusString *config_file,
|
|||
}
|
||||
|
||||
if (print_addr_fd > 2)
|
||||
_dbus_close (print_addr_fd, NULL);
|
||||
_dbus_close_socket (print_addr_fd, NULL);
|
||||
|
||||
_dbus_string_free (&addr);
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ bus_context_new (const DBusString *config_file,
|
|||
}
|
||||
|
||||
bytes = _dbus_string_get_length (&pid);
|
||||
if (_dbus_write (print_pid_fd, &pid, 0, bytes) != bytes)
|
||||
if (_dbus_write_socket (print_pid_fd, &pid, 0, bytes) != bytes)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_FAILED,
|
||||
"Printing message bus PID: %s\n",
|
||||
|
|
@ -741,7 +741,7 @@ bus_context_new (const DBusString *config_file,
|
|||
}
|
||||
|
||||
if (print_pid_fd > 2)
|
||||
_dbus_close (print_pid_fd, NULL);
|
||||
_dbus_close_socket (print_pid_fd, NULL);
|
||||
|
||||
_dbus_string_free (&pid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ signal_handler (int sig)
|
|||
#endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
|
||||
case SIGHUP:
|
||||
_dbus_string_init_const (&str, "foo");
|
||||
if (!_dbus_write (reload_pipe[RELOAD_WRITE_END], &str, 0, 1))
|
||||
if (!_dbus_write_socket (reload_pipe[RELOAD_WRITE_END], &str, 0, 1))
|
||||
{
|
||||
_dbus_warn ("Unable to write to reload pipe.\n");
|
||||
exit (1);
|
||||
|
|
@ -150,7 +150,7 @@ handle_reload_watch (DBusWatch *watch,
|
|||
DBusError error;
|
||||
DBusString str;
|
||||
_dbus_string_init (&str);
|
||||
if (_dbus_read (reload_pipe[RELOAD_READ_END], &str, 1) != 1)
|
||||
if (_dbus_read_socket (reload_pipe[RELOAD_READ_END], &str, 1) != 1)
|
||||
{
|
||||
_dbus_warn ("Couldn't read from reload pipe.\n");
|
||||
exit (1);
|
||||
|
|
|
|||
|
|
@ -104,8 +104,9 @@ DBUS_SHARED_SOURCES= \
|
|||
dbus-string.h \
|
||||
dbus-string-private.h \
|
||||
dbus-sysdeps.c \
|
||||
dbus-sysdeps-unix.c \
|
||||
dbus-sysdeps.h \
|
||||
dbus-sysdeps-unix.c \
|
||||
dbus-sysdeps-unix.h \
|
||||
dbus-userdb.c \
|
||||
dbus-userdb.h
|
||||
|
||||
|
|
|
|||
|
|
@ -260,8 +260,8 @@ _dbus_transport_debug_pipe_new (const char *server_name,
|
|||
NULL, &address);
|
||||
if (client_transport == NULL)
|
||||
{
|
||||
_dbus_close (client_fd, NULL);
|
||||
_dbus_close (server_fd, NULL);
|
||||
_dbus_close_socket (client_fd, NULL);
|
||||
_dbus_close_socket (server_fd, NULL);
|
||||
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
|
||||
_dbus_string_free (&address);
|
||||
return NULL;
|
||||
|
|
@ -276,7 +276,7 @@ _dbus_transport_debug_pipe_new (const char *server_name,
|
|||
if (server_transport == NULL)
|
||||
{
|
||||
_dbus_transport_unref (client_transport);
|
||||
_dbus_close (server_fd, NULL);
|
||||
_dbus_close_socket (server_fd, NULL);
|
||||
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ handle_new_client_fd_and_unlock (DBusServer *server,
|
|||
transport = _dbus_transport_new_for_fd (client_fd, &server->guid_hex, NULL);
|
||||
if (transport == NULL)
|
||||
{
|
||||
_dbus_close (client_fd, NULL);
|
||||
_dbus_close_socket (client_fd, NULL);
|
||||
SERVER_UNLOCK (server);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ unix_disconnect (DBusServer *server)
|
|||
unix_server->watch = NULL;
|
||||
}
|
||||
|
||||
_dbus_close (unix_server->fd, NULL);
|
||||
_dbus_close_socket (unix_server->fd, NULL);
|
||||
unix_server->fd = -1;
|
||||
|
||||
if (unix_server->socket_name != NULL)
|
||||
|
|
@ -373,7 +373,7 @@ _dbus_server_new_for_domain_socket (const char *path,
|
|||
return server;
|
||||
|
||||
failed_2:
|
||||
_dbus_close (listen_fd, NULL);
|
||||
_dbus_close_socket (listen_fd, NULL);
|
||||
failed_1:
|
||||
dbus_free (path_copy);
|
||||
failed_0:
|
||||
|
|
@ -436,7 +436,7 @@ _dbus_server_new_for_tcp_socket (const char *host,
|
|||
if (server == NULL)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
|
||||
_dbus_close (listen_fd, NULL);
|
||||
_dbus_close_socket (listen_fd, NULL);
|
||||
_dbus_string_free (&address);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,13 +276,13 @@ _dbus_babysitter_unref (DBusBabysitter *sitter)
|
|||
* a hangup and then the babysitter will
|
||||
* quit itself.
|
||||
*/
|
||||
_dbus_close (sitter->socket_to_babysitter, NULL);
|
||||
_dbus_close_socket (sitter->socket_to_babysitter, NULL);
|
||||
sitter->socket_to_babysitter = -1;
|
||||
}
|
||||
|
||||
if (sitter->error_pipe_from_child >= 0)
|
||||
{
|
||||
_dbus_close (sitter->error_pipe_from_child, NULL);
|
||||
_dbus_close_socket (sitter->error_pipe_from_child, NULL);
|
||||
sitter->error_pipe_from_child = -1;
|
||||
}
|
||||
|
||||
|
|
@ -470,7 +470,7 @@ static void
|
|||
close_socket_to_babysitter (DBusBabysitter *sitter)
|
||||
{
|
||||
_dbus_verbose ("Closing babysitter\n");
|
||||
_dbus_close (sitter->socket_to_babysitter, NULL);
|
||||
_dbus_close_socket (sitter->socket_to_babysitter, NULL);
|
||||
sitter->socket_to_babysitter = -1;
|
||||
}
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ static void
|
|||
close_error_pipe_from_child (DBusBabysitter *sitter)
|
||||
{
|
||||
_dbus_verbose ("Closing child error\n");
|
||||
_dbus_close (sitter->error_pipe_from_child, NULL);
|
||||
_dbus_close_socket (sitter->error_pipe_from_child, NULL);
|
||||
sitter->error_pipe_from_child = -1;
|
||||
}
|
||||
|
||||
|
|
@ -753,7 +753,7 @@ close_and_invalidate (int *fd)
|
|||
return -1;
|
||||
else
|
||||
{
|
||||
ret = _dbus_close (*fd, NULL);
|
||||
ret = _dbus_close_socket (*fd, NULL);
|
||||
*fd = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "dbus-internals.h"
|
||||
#include "dbus-sysdeps.h"
|
||||
#include "dbus-sysdeps-unix.h"
|
||||
#include "dbus-threads.h"
|
||||
#include "dbus-protocol.h"
|
||||
#include "dbus-string.h"
|
||||
|
|
@ -76,6 +77,54 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
dbus_bool_t
|
||||
_dbus_open_socket (int *fd,
|
||||
int domain,
|
||||
int type,
|
||||
int protocol)
|
||||
{
|
||||
*fd = socket (domain, type, protocol);
|
||||
return fd >= 0;
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
_dbus_close_socket (int fd,
|
||||
DBusError *error)
|
||||
{
|
||||
return _dbus_close (fd, error);
|
||||
}
|
||||
|
||||
int
|
||||
_dbus_read_socket (int fd,
|
||||
DBusString *buffer,
|
||||
int count)
|
||||
{
|
||||
return _dbus_read (fd, buffer, count);
|
||||
}
|
||||
|
||||
int
|
||||
_dbus_write_socket (int fd,
|
||||
const DBusString *buffer,
|
||||
int start,
|
||||
int len)
|
||||
{
|
||||
return _dbus_write (fd, buffer, start, len);
|
||||
}
|
||||
|
||||
int
|
||||
_dbus_write_socket_two (int fd,
|
||||
const DBusString *buffer1,
|
||||
int start1,
|
||||
int len1,
|
||||
const DBusString *buffer2,
|
||||
int start2,
|
||||
int len2)
|
||||
{
|
||||
return _dbus_write_two (fd, buffer1, start1, len1,
|
||||
buffer2, start2, len2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Thin wrapper around the read() system call that appends
|
||||
* the data it reads to the DBusString buffer. It appends
|
||||
|
|
@ -306,9 +355,8 @@ _dbus_connect_unix_socket (const char *path,
|
|||
_dbus_verbose ("connecting to unix socket %s abstract=%d\n",
|
||||
path, abstract);
|
||||
|
||||
fd = socket (PF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (fd < 0)
|
||||
if (!_dbus_open_socket (&fd, PF_UNIX, SOCK_STREAM, 0))
|
||||
{
|
||||
dbus_set_error (error,
|
||||
_dbus_error_from_errno (errno),
|
||||
|
|
@ -442,9 +490,7 @@ _dbus_listen_unix_socket (const char *path,
|
|||
_dbus_verbose ("listening on unix socket %s abstract=%d\n",
|
||||
path, abstract);
|
||||
|
||||
listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (listen_fd < 0)
|
||||
if (!_dbus_open_socket (&listen_fd, PF_UNIX, SOCK_STREAM, 0))
|
||||
{
|
||||
dbus_set_error (error, _dbus_error_from_errno (errno),
|
||||
"Failed to create socket \"%s\": %s",
|
||||
|
|
@ -578,10 +624,9 @@ _dbus_connect_tcp_socket (const char *host,
|
|||
struct in_addr *haddr;
|
||||
|
||||
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
|
||||
|
||||
|
||||
fd = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (fd < 0)
|
||||
if (!_dbus_open_socket (&fd, AF_INET, SOCK_STREAM, 0))
|
||||
{
|
||||
dbus_set_error (error,
|
||||
_dbus_error_from_errno (errno),
|
||||
|
|
@ -658,9 +703,8 @@ _dbus_listen_tcp_socket (const char *host,
|
|||
|
||||
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
|
||||
|
||||
listen_fd = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
if (listen_fd < 0)
|
||||
if (!_dbus_open_socket (&listen_fd, AF_INET, SOCK_STREAM, 0))
|
||||
{
|
||||
dbus_set_error (error, _dbus_error_from_errno (errno),
|
||||
"Failed to create socket \"%s:%d\": %s",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
*/
|
||||
#include "dbus-sysdeps.h"
|
||||
#include "dbus-sysdeps-unix.h"
|
||||
#include "dbus-internals.h"
|
||||
#include "dbus-protocol.h"
|
||||
#include "dbus-string.h"
|
||||
|
|
@ -152,7 +153,7 @@ _dbus_become_daemon (const DBusString *pidfile,
|
|||
}
|
||||
|
||||
bytes = _dbus_string_get_length (&pid);
|
||||
if (_dbus_write (print_pid_fd, &pid, 0, bytes) != bytes)
|
||||
if (_dbus_write_socket (print_pid_fd, &pid, 0, bytes) != bytes)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_FAILED,
|
||||
"Printing message bus PID: %s\n",
|
||||
|
|
|
|||
|
|
@ -74,20 +74,6 @@ const char* _dbus_getenv (const char *varname);
|
|||
dbus_bool_t _dbus_setenv (const char *varname,
|
||||
const char *value);
|
||||
|
||||
int _dbus_read (int fd,
|
||||
DBusString *buffer,
|
||||
int count);
|
||||
int _dbus_write (int fd,
|
||||
const DBusString *buffer,
|
||||
int start,
|
||||
int len);
|
||||
int _dbus_write_two (int fd,
|
||||
const DBusString *buffer1,
|
||||
int start1,
|
||||
int len1,
|
||||
const DBusString *buffer2,
|
||||
int start2,
|
||||
int len2);
|
||||
|
||||
typedef unsigned long dbus_pid_t;
|
||||
typedef unsigned long dbus_uid_t;
|
||||
|
|
@ -101,15 +87,39 @@ typedef unsigned long dbus_gid_t;
|
|||
#define DBUS_UID_FORMAT "%lu"
|
||||
#define DBUS_GID_FORMAT "%lu"
|
||||
|
||||
|
||||
/**
|
||||
* Struct representing socket credentials
|
||||
* Socket interface
|
||||
*
|
||||
* @todo Use for the file descriptors a struct
|
||||
* - struct DBusSocket{ int d; }; -
|
||||
* instead of int to get type-safety which
|
||||
* will be checked by the compiler.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
dbus_pid_t pid; /**< process ID or DBUS_PID_UNSET */
|
||||
dbus_uid_t uid; /**< user ID or DBUS_UID_UNSET */
|
||||
dbus_gid_t gid; /**< group ID or DBUS_GID_UNSET */
|
||||
} DBusCredentials;
|
||||
|
||||
dbus_bool_t _dbus_open_socket (int *fd,
|
||||
int domain,
|
||||
int type,
|
||||
int protocol);
|
||||
dbus_bool_t _dbus_close_socket (int fd,
|
||||
DBusError *error);
|
||||
int _dbus_read_socket (int fd,
|
||||
DBusString *buffer,
|
||||
int count);
|
||||
int _dbus_write_socket (int fd,
|
||||
const DBusString *buffer,
|
||||
int start,
|
||||
int len);
|
||||
int _dbus_write_socket_two (int fd,
|
||||
const DBusString *buffer1,
|
||||
int start1,
|
||||
int len1,
|
||||
const DBusString *buffer2,
|
||||
int start2,
|
||||
int len2);
|
||||
|
||||
|
||||
|
||||
int _dbus_connect_unix_socket (const char *path,
|
||||
dbus_bool_t abstract,
|
||||
|
|
@ -125,6 +135,16 @@ int _dbus_listen_tcp_socket (const char *host,
|
|||
DBusError *error);
|
||||
int _dbus_accept (int listen_fd);
|
||||
|
||||
/**
|
||||
* Struct representing socket credentials
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
dbus_pid_t pid; /**< process ID or DBUS_PID_UNSET */
|
||||
dbus_uid_t uid; /**< user ID or DBUS_UID_UNSET */
|
||||
dbus_gid_t gid; /**< group ID or DBUS_GID_UNSET */
|
||||
} DBusCredentials;
|
||||
|
||||
dbus_bool_t _dbus_read_credentials_unix_socket (int client_fd,
|
||||
DBusCredentials *credentials,
|
||||
DBusError *error);
|
||||
|
|
@ -223,7 +243,10 @@ void _dbus_sleep_milliseconds (int milliseconds);
|
|||
void _dbus_get_current_time (long *tv_sec,
|
||||
long *tv_usec);
|
||||
|
||||
|
||||
/**
|
||||
* File/directory interface
|
||||
*/
|
||||
dbus_bool_t _dbus_file_exists (const char *file);
|
||||
dbus_bool_t _dbus_file_get_contents (DBusString *str,
|
||||
const DBusString *filename,
|
||||
DBusError *error);
|
||||
|
|
@ -258,6 +281,13 @@ void _dbus_directory_close (DBusDirIter *iter);
|
|||
dbus_bool_t _dbus_check_dir_is_private_to_user (DBusString *dir,
|
||||
DBusError *error);
|
||||
|
||||
void _dbus_fd_set_close_on_exec (int fd);
|
||||
|
||||
const char* _dbus_get_tmpdir (void);
|
||||
|
||||
/**
|
||||
* Random numbers
|
||||
*/
|
||||
void _dbus_generate_pseudorandom_bytes_buffer (char *buffer,
|
||||
int n_bytes);
|
||||
void _dbus_generate_random_bytes_buffer (char *buffer,
|
||||
|
|
@ -272,7 +302,6 @@ const char* _dbus_error_from_errno (int error_number);
|
|||
|
||||
void _dbus_disable_sigpipe (void);
|
||||
|
||||
void _dbus_fd_set_close_on_exec (int fd);
|
||||
|
||||
void _dbus_exit (int code) _DBUS_GNUC_NORETURN;
|
||||
|
||||
|
|
@ -302,8 +331,6 @@ dbus_bool_t _dbus_full_duplex_pipe (int *fd1,
|
|||
int *fd2,
|
||||
dbus_bool_t blocking,
|
||||
DBusError *error);
|
||||
dbus_bool_t _dbus_close (int fd,
|
||||
DBusError *error);
|
||||
|
||||
void _dbus_print_backtrace (void);
|
||||
|
||||
|
|
@ -322,10 +349,8 @@ typedef void (* DBusSignalHandler) (int sig);
|
|||
void _dbus_set_signal_handler (int sig,
|
||||
DBusSignalHandler handler);
|
||||
|
||||
dbus_bool_t _dbus_file_exists (const char *file);
|
||||
dbus_bool_t _dbus_user_at_console (const char *username,
|
||||
DBusError *error);
|
||||
const char* _dbus_get_tmpdir (void);
|
||||
|
||||
/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
|
||||
* config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
|
||||
|
|
|
|||
|
|
@ -250,8 +250,8 @@ read_data_into_auth (DBusTransport *transport,
|
|||
|
||||
_dbus_auth_get_buffer (transport->auth, &buffer);
|
||||
|
||||
bytes_read = _dbus_read (unix_transport->fd,
|
||||
buffer, unix_transport->max_bytes_read_per_iteration);
|
||||
bytes_read = _dbus_read_socket (unix_transport->fd,
|
||||
buffer, unix_transport->max_bytes_read_per_iteration);
|
||||
|
||||
_dbus_auth_return_buffer (transport->auth, buffer,
|
||||
bytes_read > 0 ? bytes_read : 0);
|
||||
|
|
@ -305,9 +305,9 @@ write_data_from_auth (DBusTransport *transport)
|
|||
&buffer))
|
||||
return FALSE;
|
||||
|
||||
bytes_written = _dbus_write (unix_transport->fd,
|
||||
buffer,
|
||||
0, _dbus_string_get_length (buffer));
|
||||
bytes_written = _dbus_write_socket (unix_transport->fd,
|
||||
buffer,
|
||||
0, _dbus_string_get_length (buffer));
|
||||
|
||||
if (bytes_written > 0)
|
||||
{
|
||||
|
|
@ -556,10 +556,10 @@ do_writing (DBusTransport *transport)
|
|||
#endif
|
||||
|
||||
bytes_written =
|
||||
_dbus_write (unix_transport->fd,
|
||||
&unix_transport->encoded_outgoing,
|
||||
unix_transport->message_bytes_written,
|
||||
total_bytes_to_write - unix_transport->message_bytes_written);
|
||||
_dbus_write_socket (unix_transport->fd,
|
||||
&unix_transport->encoded_outgoing,
|
||||
unix_transport->message_bytes_written,
|
||||
total_bytes_to_write - unix_transport->message_bytes_written);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -573,21 +573,21 @@ do_writing (DBusTransport *transport)
|
|||
if (unix_transport->message_bytes_written < header_len)
|
||||
{
|
||||
bytes_written =
|
||||
_dbus_write_two (unix_transport->fd,
|
||||
header,
|
||||
unix_transport->message_bytes_written,
|
||||
header_len - unix_transport->message_bytes_written,
|
||||
body,
|
||||
0, body_len);
|
||||
_dbus_write_socket_two (unix_transport->fd,
|
||||
header,
|
||||
unix_transport->message_bytes_written,
|
||||
header_len - unix_transport->message_bytes_written,
|
||||
body,
|
||||
0, body_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes_written =
|
||||
_dbus_write (unix_transport->fd,
|
||||
body,
|
||||
(unix_transport->message_bytes_written - header_len),
|
||||
body_len -
|
||||
(unix_transport->message_bytes_written - header_len));
|
||||
_dbus_write_socket (unix_transport->fd,
|
||||
body,
|
||||
(unix_transport->message_bytes_written - header_len),
|
||||
body_len -
|
||||
(unix_transport->message_bytes_written - header_len));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -682,9 +682,9 @@ do_reading (DBusTransport *transport)
|
|||
if (_dbus_string_get_length (&unix_transport->encoded_incoming) > 0)
|
||||
bytes_read = _dbus_string_get_length (&unix_transport->encoded_incoming);
|
||||
else
|
||||
bytes_read = _dbus_read (unix_transport->fd,
|
||||
&unix_transport->encoded_incoming,
|
||||
unix_transport->max_bytes_read_per_iteration);
|
||||
bytes_read = _dbus_read_socket (unix_transport->fd,
|
||||
&unix_transport->encoded_incoming,
|
||||
unix_transport->max_bytes_read_per_iteration);
|
||||
|
||||
_dbus_assert (_dbus_string_get_length (&unix_transport->encoded_incoming) ==
|
||||
bytes_read);
|
||||
|
|
@ -719,8 +719,8 @@ do_reading (DBusTransport *transport)
|
|||
_dbus_message_loader_get_buffer (transport->loader,
|
||||
&buffer);
|
||||
|
||||
bytes_read = _dbus_read (unix_transport->fd,
|
||||
buffer, unix_transport->max_bytes_read_per_iteration);
|
||||
bytes_read = _dbus_read_socket (unix_transport->fd,
|
||||
buffer, unix_transport->max_bytes_read_per_iteration);
|
||||
|
||||
_dbus_message_loader_return_buffer (transport->loader,
|
||||
buffer,
|
||||
|
|
@ -882,7 +882,7 @@ unix_disconnect (DBusTransport *transport)
|
|||
|
||||
free_watches (transport);
|
||||
|
||||
_dbus_close (unix_transport->fd, NULL);
|
||||
_dbus_close_socket (unix_transport->fd, NULL);
|
||||
unix_transport->fd = -1;
|
||||
}
|
||||
|
||||
|
|
@ -1247,7 +1247,7 @@ _dbus_transport_new_for_domain_socket (const char *path,
|
|||
return transport;
|
||||
|
||||
failed_1:
|
||||
_dbus_close (fd, NULL);
|
||||
_dbus_close_socket (fd, NULL);
|
||||
failed_0:
|
||||
_dbus_string_free (&address);
|
||||
return NULL;
|
||||
|
|
@ -1307,7 +1307,7 @@ _dbus_transport_new_for_tcp_socket (const char *host,
|
|||
if (transport == NULL)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
|
||||
_dbus_close (fd, NULL);
|
||||
_dbus_close_socket (fd, NULL);
|
||||
_dbus_string_free (&address);
|
||||
fd = -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue