aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/libmemif/src/main.c21
-rw-r--r--extras/libmemif/src/socket.c8
-rw-r--r--extras/libmemif/src/socket.h2
3 files changed, 15 insertions, 16 deletions
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 56458515485..d0c1087e4a9 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -686,9 +686,8 @@ memif_create (memif_conn_handle_t * c, memif_conn_args_t * args,
MEMIF_DEFAULT_SOCKET_FILENAME, sfl);
}
- if (args->secret)
+ if ((l = strlen ((char *) args->secret)) > 0)
{
- l = strlen ((char *) args->secret);
strncpy ((char *) conn->args.secret, (char *) args->secret, l);
}
@@ -886,7 +885,7 @@ memif_control_fd_handler (int fd, uint8_t events)
sun.sun_family = AF_UNIX;
- strncpy (sun.sun_path, conn->args.socket_filename,
+ strncpy (sun.sun_path, (char*) conn->args.socket_filename,
sizeof (sun.sun_path) - 1);
if (connect (sockfd, (struct sockaddr *) &sun,
@@ -1090,7 +1089,7 @@ memif_disconnect_internal (memif_connection_t * c)
if (c->fd > 0)
{
- memif_msg_send_disconnect (c->fd, "interface deleted", 0);
+ memif_msg_send_disconnect (c->fd, (uint8_t *) "interface deleted", 0);
lm->control_fd_update (c->fd, MEMIF_FD_EVENT_DEL);
close (c->fd);
}
@@ -1882,7 +1881,7 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
l1 = strlen ((char *) c->args.interface_name);
if (l0 + l1 < buflen)
{
- md->if_name = strcpy (buf + l0, (char *) c->args.interface_name);
+ md->if_name = (uint8_t *) strcpy (buf + l0, (char *) c->args.interface_name);
l0 += l1 + 1;
}
else
@@ -1891,7 +1890,7 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
l1 = strlen ((char *) lm->app_name);
if (l0 + l1 < buflen)
{
- md->inst_name = strcpy (buf + l0, (char *) lm->app_name);
+ md->inst_name = (uint8_t *) strcpy (buf + l0, (char *) lm->app_name);
l0 += l1 + 1;
}
else
@@ -1900,7 +1899,7 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
l1 = strlen ((char *) c->remote_if_name);
if (l0 + l1 < buflen)
{
- md->remote_if_name = strcpy (buf + l0, (char *) c->remote_if_name);
+ md->remote_if_name = (uint8_t *) strcpy (buf + l0, (char *) c->remote_if_name);
l0 += l1 + 1;
}
else
@@ -1909,7 +1908,7 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
l1 = strlen ((char *) c->remote_name);
if (l0 + l1 < buflen)
{
- md->remote_inst_name = strcpy (buf + l0, (char *) c->remote_name);
+ md->remote_inst_name = (uint8_t *) strcpy (buf + l0, (char *) c->remote_name);
l0 += l1 + 1;
}
else
@@ -1917,12 +1916,12 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
md->id = c->args.interface_id;
- if (c->args.secret)
+ if (strlen((char *) c->args.secret) > 0)
{
l1 = strlen ((char *) c->args.secret);
if (l0 + l1 < buflen)
{
- md->secret = strcpy (buf + l0, (char *) c->args.secret);
+ md->secret = (uint8_t *) strcpy (buf + l0, (char *) c->args.secret);
l0 += l1 + 1;
}
else
@@ -1936,7 +1935,7 @@ memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
if (l0 + l1 < buflen)
{
md->socket_filename =
- strcpy (buf + l0, (char *) c->args.socket_filename);
+ (uint8_t *) strcpy (buf + l0, (char *) c->args.socket_filename);
l0 += l1 + 1;
}
else
diff --git a/extras/libmemif/src/socket.c b/extras/libmemif/src/socket.c
index e568079ab25..e8b14c9acdb 100644
--- a/extras/libmemif/src/socket.c
+++ b/extras/libmemif/src/socket.c
@@ -112,7 +112,7 @@ memif_msg_send_hello (int fd)
h->max_region = MEMIF_MAX_REGION;
h->max_log2_ring_size = MEMIF_MAX_LOG2_RING_SIZE;
- strncpy ((char *) h->name, lm->app_name, strlen (lm->app_name));
+ strncpy ((char *) h->name, (char *) lm->app_name, strlen ((char *) lm->app_name));
/* msg hello is not enqueued but sent directly,
because it is the first msg to be sent */
@@ -141,7 +141,7 @@ memif_msg_enq_init (memif_connection_t * c)
strncpy ((char *) i->name, (char *) lm->app_name,
strlen ((char *) lm->app_name));
- if (c->args.secret)
+ if (strlen((char *) c->args.secret) > 0)
strncpy ((char *) i->secret, (char *) c->args.secret, sizeof (i->secret));
e->next = NULL;
@@ -424,10 +424,10 @@ memif_msg_receive_init (memif_socket_t * ms, int fd, memif_msg_t * msg)
strncpy ((char *) c->remote_name, (char *) i->name,
strlen ((char *) i->name));
- if (c->args.secret)
+ if (strlen((char *) c->args.secret) > 0)
{
int r;
- if (i->secret)
+ if (strlen((char *) i->secret) > 0)
{
if (strlen ((char *) c->args.secret) != strlen ((char *) i->secret))
{
diff --git a/extras/libmemif/src/socket.h b/extras/libmemif/src/socket.h
index a8e9fbce9f6..e0792270b53 100644
--- a/extras/libmemif/src/socket.h
+++ b/extras/libmemif/src/socket.h
@@ -16,7 +16,7 @@
*/
#ifndef _SOCKET_H_
-#define _SOCKET_H
+#define _SOCKET_H_
#include <memif_private.h>