* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sockaddr.c,v 1.63 2005/02/24 00:33:33 marka Exp $ */
+/* $Id: sockaddr.c,v 1.64 2005/03/16 23:39:05 marka Exp $ */
#include <config.h>
break;
#ifdef ISC_PLAFORM_HAVESYSUNH
case AF_UNIX:
- plen = strlen(sockaddr->type.sun.sun_path);
+ plen = strlen(sockaddr->type.sunix.sun_path);
if (plen >= isc_buffer_availablelength(target))
return (ISC_R_NOSPACE);
- isc_buffer_putmem(target, sockaddr->type.sun.sun_path, plen);
+ isc_buffer_putmem(target, sockaddr->type.sunix.sun_path, plen);
/*
* Null terminate after used region.
isc_result_t
isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path) {
#ifdef ISC_PLATFORM_HAVESYSUNH
- if (strlen(path) >= sizeof(sockaddr->type.sun.sun_path))
+ if (strlen(path) >= sizeof(sockaddr->type.sunix.sun_path))
return (ISC_R_NOSPACE);
memset(sockaddr, 0, sizeof(*sockaddr));
- sockaddr->length = sizeof(sockaddr->type.sun);
- sockaddr->type.sun.sun_family = AF_UNIX;
+ sockaddr->length = sizeof(sockaddr->type.sunix);
+ sockaddr->type.sunix.sun_family = AF_UNIX;
#ifdef ISC_PLATFORM_HAVESALEN
- sockaddr->type.sun.sun_len = sizeof(sockaddr->type.sun);
+ sockaddr->type.sunix.sun_len = sizeof(sockaddr->type.sunix);
#endif
- strcpy(sockaddr->type.sun.sun_path, path);
+ strcpy(sockaddr->type.sunix.sun_path, path);
return (ISC_R_SUCCESS);
#else
UNUSED(sockaddr);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.246 2005/03/15 01:41:28 marka Exp $ */
+/* $Id: socket.c,v 1.247 2005/03/16 23:39:06 marka Exp $ */
#include <config.h>
#endif
if (active) {
- if (stat(sockaddr->type.sun.sun_path, &sb) < 0) {
+ if (stat(sockaddr->type.sunix.sun_path, &sb) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
"isc_socket_cleanunix: stat(%s): %s",
- sockaddr->type.sun.sun_path, strbuf);
+ sockaddr->type.sunix.sun_path, strbuf);
return;
}
if (!(S_ISSOCK(sb.st_mode) || S_ISFIFO(sb.st_mode))) {
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
"isc_socket_cleanunix: %s: not a socket",
- sockaddr->type.sun.sun_path);
+ sockaddr->type.sunix.sun_path);
return;
}
- if (unlink(sockaddr->type.sun.sun_path) < 0) {
+ if (unlink(sockaddr->type.sunix.sun_path) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_ERROR,
"isc_socket_cleanunix: unlink(%s): %s",
- sockaddr->type.sun.sun_path, strbuf);
+ sockaddr->type.sunix.sun_path, strbuf);
}
return;
}
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING,
"isc_socket_cleanunix: socket(%s): %s",
- sockaddr->type.sun.sun_path, strbuf);
+ sockaddr->type.sunix.sun_path, strbuf);
return;
}
- if (stat(sockaddr->type.sun.sun_path, &sb) < 0) {
+ if (stat(sockaddr->type.sunix.sun_path, &sb) < 0) {
switch (errno) {
case ENOENT: /* We exited cleanly last time */
break;
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING,
"isc_socket_cleanunix: stat(%s): %s",
- sockaddr->type.sun.sun_path, strbuf);
+ sockaddr->type.sunix.sun_path, strbuf);
break;
}
goto cleanup;
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING,
"isc_socket_cleanunix: %s: not a socket",
- sockaddr->type.sun.sun_path);
+ sockaddr->type.sunix.sun_path);
goto cleanup;
}
- if (connect(s, (struct sockaddr *)&sockaddr->type.sun,
- sizeof(sockaddr->type.sun)) < 0) {
+ if (connect(s, (struct sockaddr *)&sockaddr->type.sunix,
+ sizeof(sockaddr->type.sunix)) < 0) {
switch (errno) {
case ECONNREFUSED:
case ECONNRESET:
- if (unlink(sockaddr->type.sun.sun_path) < 0) {
+ if (unlink(sockaddr->type.sunix.sun_path) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET,
ISC_LOG_WARNING,
"isc_socket_cleanunix: "
"unlink(%s): %s",
- sockaddr->type.sun.sun_path,
+ sockaddr->type.sunix.sun_path,
strbuf);
}
break;
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
ISC_LOGMODULE_SOCKET, ISC_LOG_WARNING,
"isc_socket_cleanunix: connect(%s): %s",
- sockaddr->type.sun.sun_path, strbuf);
+ sockaddr->type.sunix.sun_path, strbuf);
break;
}
}
#ifdef ISC_PLATFORM_HAVESYSUNH
isc_result_t result = ISC_R_SUCCESS;
char strbuf[ISC_STRERRORSIZE];
- char path[sizeof(sockaddr->type.sun.sun_path)];
+ char path[sizeof(sockaddr->type.sunix.sun_path)];
#ifdef NEED_SECURE_DIRECTORY
char *slash;
#endif
REQUIRE(sockaddr->type.sa.sa_family == AF_UNIX);
- INSIST(strlen(sockaddr->type.sun.sun_path) < sizeof(path));
- strcpy(path, sockaddr->type.sun.sun_path);
+ INSIST(strlen(sockaddr->type.sunix.sun_path) < sizeof(path));
+ strcpy(path, sockaddr->type.sunix.sun_path);
#ifdef NEED_SECURE_DIRECTORY
slash = strrchr(path, '/');