{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Abstract socket name too long\n");
- close (fd);
+ _dbus_close (fd, NULL);
return -1;
}
#else /* HAVE_ABSTRACT_SOCKETS */
dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
"Operating system does not support abstract socket namespace\n");
- close (fd);
+ _dbus_close (fd, NULL);
return -1;
#endif /* ! HAVE_ABSTRACT_SOCKETS */
}
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Socket name too long\n");
- close (fd);
+ _dbus_close (fd, NULL);
return -1;
}
"Failed to connect to socket %s: %s",
path, _dbus_strerror (errno));
- close (fd);
+ _dbus_close (fd, NULL);
fd = -1;
return -1;
{
_DBUS_ASSERT_ERROR_IS_SET (error);
- close (fd);
+ _dbus_close (fd, NULL);
fd = -1;
return -1;
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Abstract socket name too long\n");
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
#else /* HAVE_ABSTRACT_SOCKETS */
dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
"Operating system does not support abstract socket namespace\n");
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
#endif /* ! HAVE_ABSTRACT_SOCKETS */
}
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Abstract socket name too long\n");
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to bind socket \"%s\": %s",
path, _dbus_strerror (errno));
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to listen on socket \"%s\": %s",
path, _dbus_strerror (errno));
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
if (!_dbus_set_fd_nonblocking (listen_fd, error))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
_dbus_error_from_errno (errno),
"Failed to lookup hostname: %s",
host);
- close (fd);
+ _dbus_close (fd, NULL);
return -1;
}
"Failed to connect to socket %s:%d %s",
host, port, _dbus_strerror (errno));
- close (fd);
+ _dbus_close (fd, NULL);
fd = -1;
return -1;
if (!_dbus_set_fd_nonblocking (fd, error))
{
- close (fd);
+ _dbus_close (fd, NULL);
fd = -1;
return -1;
_dbus_error_from_errno (errno),
"Failed to lookup hostname: %s",
host);
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to bind socket \"%s:%d\": %s",
host, port, _dbus_strerror (errno));
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to listen on socket \"%s:%d\": %s",
host, port, _dbus_strerror (errno));
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
if (!_dbus_set_fd_nonblocking (listen_fd, error))
{
- close (listen_fd);
+ _dbus_close (listen_fd, NULL);
return -1;
}
_dbus_verbose ("fstat() failed: %s",
_dbus_strerror (errno));
- close (fd);
+ _dbus_close (fd, NULL);
return FALSE;
}
dbus_set_error (error, DBUS_ERROR_FAILED,
"File size %lu of \"%s\" is too large.",
(unsigned long) sb.st_size, filename_c);
- close (fd);
+ _dbus_close (fd, NULL);
return FALSE;
}
_dbus_verbose ("read() failed: %s",
_dbus_strerror (errno));
- close (fd);
+ _dbus_close (fd, NULL);
_dbus_string_set_length (str, orig_len);
return FALSE;
}
total += bytes_read;
}
- close (fd);
+ _dbus_close (fd, NULL);
return TRUE;
}
else if (sb.st_size != 0)
dbus_set_error (error, DBUS_ERROR_FAILED,
"\"%s\" is not a regular file",
filename_c);
- close (fd);
+ _dbus_close (fd, NULL);
return FALSE;
}
else
{
- close (fd);
+ _dbus_close (fd, NULL);
return TRUE;
}
}
total += bytes_written;
}
- if (close (fd) < 0)
+ if (!_dbus_close (fd, NULL))
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Could not close file %s: %s",
*/
if (fd >= 0)
- close (fd);
+ _dbus_close (fd, NULL);
if (need_unlink && unlink (tmp_filename_c) < 0)
_dbus_verbose ("Failed to unlink temp file %s: %s\n",
return FALSE;
}
- if (close (fd) < 0)
+ if (!_dbus_close (fd, NULL))
{
dbus_set_error (error,
DBUS_ERROR_FAILED,
if (_dbus_read (fd, str, n_bytes) != n_bytes)
{
- close (fd);
+ _dbus_close (fd, NULL);
_dbus_string_set_length (str, old_len);
return pseudorandom_generate_random_bytes (str, n_bytes);
}
_dbus_verbose ("Read %d bytes from /dev/urandom\n",
n_bytes);
- close (fd);
+ _dbus_close (fd, NULL);
return TRUE;
}
dbus_set_error (error, _dbus_error_from_errno (errno),
"Could not set full-duplex pipe nonblocking");
- close (fds[0]);
- close (fds[1]);
+ _dbus_close (fds[0], NULL);
+ _dbus_close (fds[1], NULL);
return FALSE;
}