Created
March 30, 2010 01:04
-
-
Save actsasflinn/348633 to your computer and use it in GitHub Desktop.
Tokyo Tyrant patch fix unix sockets on Mac OSX Snow Leopard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ttutil.c.orig 2010-03-13 00:33:29.000000000 -0500 | |
+++ ttutil.c 2010-03-13 00:34:05.000000000 -0500 | |
@@ -127,7 +127,7 @@ int ttopensockunix(const char *path){ | |
struct sockaddr_un saun; | |
memset(&saun, 0, sizeof(saun)); | |
saun.sun_family = AF_UNIX; | |
- snprintf(saun.sun_path, SOCKPATHBUFSIZ, "%s", path); | |
+ strncpy(saun.sun_path, path, sizeof(saun.sun_path)-1); | |
int fd = socket(PF_UNIX, SOCK_STREAM, 0); | |
if(fd == -1) return -1; | |
int optint = 1; | |
@@ -187,7 +187,7 @@ int ttopenservsockunix(const char *path) | |
struct sockaddr_un saun; | |
memset(&saun, 0, sizeof(saun)); | |
saun.sun_family = AF_UNIX; | |
- snprintf(saun.sun_path, SOCKPATHBUFSIZ, "%s", path); | |
+ strncpy(saun.sun_path, path, sizeof(saun.sun_path)-1); | |
int fd = socket(PF_UNIX, SOCK_STREAM, 0); | |
if(fd == -1) return -1; | |
if(bind(fd, (struct sockaddr *)&saun, sizeof(saun)) != 0 || |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment