1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

Better code to obtain socket length. No functional change.

Submitted by:	vanilla
This commit is contained in:
Clive Lin 2005-10-13 03:35:11 +00:00
parent 613cc95a21
commit 8b428ab273
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=145200
2 changed files with 16 additions and 10 deletions

View File

@ -1,11 +1,14 @@
--- im-client/gcin-im-client.c.orig Wed Oct 5 05:56:02 2005
+++ im-client/gcin-im-client.c Wed Oct 5 05:56:23 2005
@@ -94,7 +94,7 @@
--- im-client/gcin-im-client.c~ Thu Oct 13 01:11:53 2005
+++ im-client/gcin-im-client.c Thu Oct 13 01:14:23 2005
@@ -94,7 +94,11 @@
get_gcin_im_srv_sock_path(sock_path, sizeof(sock_path));
addr = sock_path;
strcpy(serv_addr.sun_path, sock_path);
- servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
+ servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family) +1;
+#ifdef SUN_LEN
+ servlen = SUN_LEN(&serv_addr);
+#else
servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
+#endif
if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("cannot open socket");

View File

@ -1,11 +1,14 @@
--- im-client/gcin-im-client.c.orig Wed Oct 5 05:56:02 2005
+++ im-client/gcin-im-client.c Wed Oct 5 05:56:23 2005
@@ -94,7 +94,7 @@
--- im-client/gcin-im-client.c~ Thu Oct 13 01:11:53 2005
+++ im-client/gcin-im-client.c Thu Oct 13 01:14:23 2005
@@ -94,7 +94,11 @@
get_gcin_im_srv_sock_path(sock_path, sizeof(sock_path));
addr = sock_path;
strcpy(serv_addr.sun_path, sock_path);
- servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
+ servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family) +1;
+#ifdef SUN_LEN
+ servlen = SUN_LEN(&serv_addr);
+#else
servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
+#endif
if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
perror("cannot open socket");