CLEANUP: tools: remove str2sun() which is not used anymore.

This commit is contained in:
Willy Tarreau 2013-03-06 15:08:16 +01:00
parent 9b435bcdfe
commit add0ab1975
2 changed files with 0 additions and 27 deletions

View File

@ -211,12 +211,6 @@ extern const char *invalid_char(const char *name);
*/
extern const char *invalid_domainchar(const char *name);
/*
* converts <str> to a struct sockaddr_un* which is locally allocated.
* The format is "/path", where "/path" is a path to a UNIX domain socket.
*/
struct sockaddr_un *str2sun(const char *str);
/*
* converts <str> to a struct sockaddr_storage* which is locally allocated. The
* string is assumed to contain only an address, no port. The address can be a

View File

@ -442,27 +442,6 @@ const char *limit_r(unsigned long n, char *buffer, int size, const char *alt)
return (n) ? ultoa_r(n, buffer, size) : (alt ? alt : "");
}
/*
* converts <str> to a struct sockaddr_un* which is locally allocated.
* The format is "/path", where "/path" is a path to a UNIX domain socket.
* NULL is returned if the socket path is invalid (too long).
*/
struct sockaddr_un *str2sun(const char *str)
{
static struct sockaddr_un su;
int strsz; /* length included null */
memset(&su, 0, sizeof(su));
strsz = strlen(str) + 1;
if (strsz > sizeof(su.sun_path)) {
return NULL;
} else {
su.sun_family = AF_UNIX;
memcpy(su.sun_path, str, strsz);
}
return &su;
}
/*
* Returns non-zero if character <s> is a hex digit (0-9, a-f, A-F), else zero.
*