diff options
author | jcid <devnull@localhost> | 2008-11-05 19:11:02 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-11-05 19:11:02 +0100 |
commit | 8d11ae65472e4a9c70476f9b165df7a114d06908 (patch) | |
tree | cfd63c085c4eee16b250ecbaaa61b9d53ff4b6aa | |
parent | 26fe2d4e6d93618c44c3ab35089f9d35eec5389b (diff) |
- Cleaned up and normalized D_SUN_LEN usage.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | dpi/bookmarks.c | 5 | ||||
-rw-r--r-- | dpi/cookies.c | 6 | ||||
-rw-r--r-- | dpi/https.c | 2 | ||||
-rw-r--r-- | dpid/dpid.c | 2 | ||||
-rw-r--r-- | src/IO/dpi.c | 6 |
6 files changed, 6 insertions, 16 deletions
@@ -17,6 +17,7 @@ dillo-2.1 +- Switched SSL-enabled to configure.in (./configure --enable-ssl). - Standardised the installation of dpid/dpidrc with auto* tools. - Set the ScrollGroup as the resizable widget in downloads dpi. + - Cleaned up and normalized D_SUN_LEN usage. Patches: Jeremy Henty +- Allowed compilation with older machines by removing a few C99isms. - Added use of inttypes.h when stdint.h isn't found. diff --git a/dpi/bookmarks.c b/dpi/bookmarks.c index e5447331..a20d8ef6 100644 --- a/dpi/bookmarks.c +++ b/dpi/bookmarks.c @@ -44,11 +44,6 @@ #define _MSG(...) #define MSG(...) printf("[bookmarks dpi]: " __VA_ARGS__) -/* This one is tricky, some sources state it should include the byte - * for the terminating NULL, and others say it shouldn't. */ -# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ - + strlen ((ptr)->sun_path)) - #define DOCTYPE \ "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n" diff --git a/dpi/cookies.c b/dpi/cookies.c index 63a1b7f8..5b5bc35d 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -64,12 +64,6 @@ int main(void) #define MSG(...) printf("[cookies dpi]: " __VA_ARGS__) -/* This one is tricky, some sources state it should include the byte - * for the terminating NULL, and others say it shouldn't. */ -# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ - + strlen ((ptr)->sun_path)) - - /* * a_List_add() * diff --git a/dpi/https.c b/dpi/https.c index 33c9b2d6..fff0be3b 100644 --- a/dpi/https.c +++ b/dpi/https.c @@ -25,7 +25,7 @@ * the https dillo plugin with the OpenSSL project's "OpenSSL" * library, and distribute the linked executables, without including * the source code for OpenSSL in the source distribution. You must - * obey the GNU General Public License, version 2, in all respects + * obey the GNU General Public License, version 3, in all respects * for all of the code used other than "OpenSSL". * */ diff --git a/dpid/dpid.c b/dpid/dpid.c index 97e6414d..2eed0f02 100644 --- a/dpid/dpid.c +++ b/dpid/dpid.c @@ -728,7 +728,6 @@ void stop_active_dpis(struct dp *dpi_attr_list, int numdpis) DpiBye_cmd = a_Dpip_build_cmd("cmd=%s", "DpiBye"); sun_path_len = sizeof(sa.sun_path); - addr_len = sizeof(dpi_addr); dpi_addr.sun_family = AF_LOCAL; @@ -746,6 +745,7 @@ void stop_active_dpis(struct dp *dpi_attr_list, int numdpis) MSG_ERR("\n - socket path = %s\n", dpi_attr_list[i].sockpath); } strncpy(dpi_addr.sun_path, dpi_attr_list[i].sockpath, sun_path_len); + addr_len = D_SUN_LEN(&dpi_addr); if (connect(dpi_socket, (struct sockaddr *) &dpi_addr, addr_len) == -1) { ERRMSG("stop_active_dpis", "connect", errno); MSG_ERR("%s\n", dpi_addr.sun_path); diff --git a/src/IO/dpi.c b/src/IO/dpi.c index 7c4357da..01d3a5b5 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -353,7 +353,7 @@ static int Dpi_check_uds(char *uds_name) strncpy(pun.sun_path, uds_name, sizeof (pun.sun_path)); if ((SockFD = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1 || - connect(SockFD, (void*)&pun, D_SUN_LEN(&pun)) == -1) { + connect(SockFD, (struct sockaddr *) &pun, D_SUN_LEN(&pun)) == -1) { MSG("Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name); } else { Dpi_close_fd(SockFD); @@ -497,7 +497,7 @@ static char *Dpi_get_server_uds_name(const char *server_name) _MSG("dpid_uds_name = [%s]\n", dpid_uds_name); strncpy(dpid.sun_path, dpid_uds_name, sizeof(dpid.sun_path)); - if (connect(sock, (struct sockaddr *) &dpid, sizeof(dpid)) == -1) + if (connect(sock, (struct sockaddr *) &dpid, D_SUN_LEN(&dpid)) == -1) perror("connect"); /* ask dpid to check the server plugin and send its UDS name back */ request = a_Dpip_build_cmd("cmd=%s msg=%s", "check_server", server_name); @@ -717,7 +717,6 @@ void a_Dpi_bye_dpid() srs_name = Dpi_get_dpid_uds_name(); sun_path_len = sizeof(sa.sun_path); - addr_len = sizeof(sa); sa.sun_family = AF_LOCAL; @@ -725,6 +724,7 @@ void a_Dpi_bye_dpid() MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno)); } strncpy(sa.sun_path, srs_name, sizeof (sa.sun_path)); + addr_len = D_SUN_LEN(&sa); if (connect(new_socket, (struct sockaddr *) &sa, addr_len) == -1) { MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno)); MSG("%s\n", sa.sun_path); |