Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m])
# -lrt might be needed for clock_gettime
OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt])

AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook __clear_cache])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook __clear_cache])

# Sanity check: ensure that we got at least one of statfs or statvfs.
if test $ac_cv_func_statfs = no && test $ac_cv_func_statvfs = no; then
Expand Down
9 changes: 3 additions & 6 deletions opal/mca/base/mca_base_component_repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "opal/constants.h"
#include "opal/class/opal_hash_table.h"
#include "opal/util/basename.h"
#include "opal/util/string_copy.h"

#if OPAL_HAVE_DL_SUPPORT

Expand Down Expand Up @@ -167,12 +168,8 @@ static int process_repository_item (const char *filename, void *data)
return OPAL_ERR_OUT_OF_RESOURCE;
}

/* strncpy does not guarantee a \0 */
ri->ri_type[MCA_BASE_MAX_TYPE_NAME_LEN] = '\0';
strncpy (ri->ri_type, type, MCA_BASE_MAX_TYPE_NAME_LEN);

ri->ri_name[MCA_BASE_MAX_TYPE_NAME_LEN] = '\0';
strncpy (ri->ri_name, name, MCA_BASE_MAX_COMPONENT_NAME_LEN);
opal_string_copy (ri->ri_type, type, MCA_BASE_MAX_TYPE_NAME_LEN);
opal_string_copy (ri->ri_name, name, MCA_BASE_MAX_COMPONENT_NAME_LEN);

opal_list_append (component_list, &ri->super);

Expand Down
3 changes: 2 additions & 1 deletion opal/mca/btl/openib/btl_openib_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#endif

#include "opal/util/show_help.h"
#include "opal/util/string_copy.h"

#include "btl_openib.h"
#include "btl_openib_lex.h"
Expand Down Expand Up @@ -324,7 +325,7 @@ static int parse_line(parsed_section_values_t *sv)
}
key_buffer = tmp;
}
strncpy(key_buffer, btl_openib_ini_yytext, key_buffer_len);
opal_string_copy(key_buffer, btl_openib_ini_yytext, key_buffer_len);

/* The first thing we have to see is an "=" */
val = btl_openib_ini_yylex();
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/btl/usnic/btl_usnic_cagent.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "opal/types.h"
#include "opal/util/output.h"
#include "opal/util/fd.h"
#include "opal/util/string_copy.h"

#include "btl_usnic.h"
#include "btl_usnic_connectivity.h"
Expand Down Expand Up @@ -1189,7 +1190,7 @@ int opal_btl_usnic_connectivity_agent_init(void)

memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
strncpy(address.sun_path, ipc_filename, sizeof(address.sun_path) - 1);
opal_string_copy(address.sun_path, ipc_filename, sizeof(address.sun_path));

if (bind(ipc_accept_fd, (struct sockaddr *) &address,
sizeof(struct sockaddr_un)) != 0) {
Expand Down
13 changes: 7 additions & 6 deletions opal/mca/btl/usnic/btl_usnic_cclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/util/fd.h"
#include "opal/util/string_copy.h"

#include "btl_usnic.h"
#include "btl_usnic_module.h"
Expand Down Expand Up @@ -103,7 +104,7 @@ int opal_btl_usnic_connectivity_client_init(void)
struct sockaddr_un address;
memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
strncpy(address.sun_path, ipc_filename, sizeof(address.sun_path) - 1);
opal_string_copy(address.sun_path, ipc_filename, sizeof(address.sun_path));

int count = 0;
while (1) {
Expand Down Expand Up @@ -195,10 +196,10 @@ int opal_btl_usnic_connectivity_listen(opal_btl_usnic_module_t *module)
}

/* Ensure to NULL-terminate the passed strings */
strncpy(cmd.nodename, opal_process_info.nodename,
CONNECTIVITY_NODENAME_LEN - 1);
strncpy(cmd.usnic_name, module->linux_device_name,
CONNECTIVITY_IFNAME_LEN - 1);
opal_string_copy(cmd.nodename, opal_process_info.nodename,
CONNECTIVITY_NODENAME_LEN);
opal_string_copy(cmd.usnic_name, module->linux_device_name,
CONNECTIVITY_IFNAME_LEN);

if (OPAL_SUCCESS != opal_fd_write(agent_fd, sizeof(cmd), &cmd)) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
Expand Down Expand Up @@ -255,7 +256,7 @@ int opal_btl_usnic_connectivity_ping(uint32_t src_ipv4_addr, int src_port,
.max_msg_size = max_msg_size
};
/* Ensure to NULL-terminate the passed string */
strncpy(cmd.dest_nodename, dest_nodename, CONNECTIVITY_NODENAME_LEN - 1);
opal_string_copy(cmd.dest_nodename, dest_nodename, CONNECTIVITY_NODENAME_LEN);

if (OPAL_SUCCESS != opal_fd_write(agent_fd, sizeof(cmd), &cmd)) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
Expand Down
5 changes: 3 additions & 2 deletions opal/mca/btl/usnic/btl_usnic_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "opal/util/show_help.h"
#include "opal/constants.h"
#include "opal/util/bipartite_graph.h"
#include "opal/util/string_copy.h"

#include "btl_usnic_compat.h"
#include "btl_usnic.h"
Expand Down Expand Up @@ -239,8 +240,8 @@ static int create_proc(opal_proc_t *opal_proc,
char protostr[32];
proto = mca_btl_usnic_component.transport_protocol;
memset(protostr, 0, sizeof(protostr));
strncpy(protostr, fi_tostr(&proto, FI_TYPE_PROTOCOL),
sizeof(protostr) - 1);
opal_string_copy(protostr, fi_tostr(&proto, FI_TYPE_PROTOCOL),
sizeof(protostr));
proto = proc->proc_modex->protocol;
opal_show_help("help-mpi-btl-usnic.txt",
"transport mismatch",
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/if/bsdx_ipv4/if_bsdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/util/string_copy.h"
#include "opal/mca/if/if.h"

static int if_bsdx_open(void);
Expand Down Expand Up @@ -125,7 +126,7 @@ static int if_bsdx_open(void)
/* fill values into the opal_if_t */
memcpy(&a4, &(sin_addr->sin_addr), sizeof(struct in_addr));

strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE);
opal_string_copy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE);
intf->if_index = opal_list_get_size(&opal_if_list) + 1;
((struct sockaddr_in*) &intf->if_addr)->sin_addr = a4;
((struct sockaddr_in*) &intf->if_addr)->sin_family = AF_INET;
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/if/bsdx_ipv6/if_bsdx_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "opal_config.h"
#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/util/string_copy.h"

#include <string.h>
#ifdef HAVE_UNISTD_H
Expand Down Expand Up @@ -198,7 +199,7 @@ static int if_bsdx_ipv6_open(void)
return OPAL_ERR_OUT_OF_RESOURCE;
}
intf->af_family = AF_INET6;
strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE);
opal_string_copy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE);
intf->if_index = opal_list_get_size(&opal_if_list) + 1;
((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6;
((struct sockaddr_in6*) &intf->if_addr)->sin6_family = AF_INET6;
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/if/linux_ipv6/if_linux_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "opal/constants.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "opal/util/string_copy.h"
#include "opal/mca/if/if.h"
#include "opal/mca/if/base/base.h"

Expand Down Expand Up @@ -143,7 +144,7 @@ static int if_linux_ipv6_open(void)
}

/* now construct the opal_if_t */
strncpy(intf->if_name, ifname, IF_NAMESIZE);
opal_string_copy(intf->if_name, ifname, IF_NAMESIZE);
intf->if_index = opal_list_get_size(&opal_if_list)+1;
intf->if_kernel_index = (uint16_t) idx;
((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6;
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/if/posix_ipv4/if_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/util/string_copy.h"
#include "opal/mca/if/if.h"
#include "opal/mca/if/base/base.h"

Expand Down Expand Up @@ -218,7 +219,7 @@ static int if_posix_open(void)

/* copy entry over into our data structure */
memset(intf->if_name, 0, sizeof(intf->if_name));
strncpy(intf->if_name, ifr->ifr_name, sizeof(intf->if_name) - 1);
opal_string_copy(intf->if_name, ifr->ifr_name, sizeof(intf->if_name));
intf->if_flags = ifr->ifr_flags;

/* every new address gets its own internal if_index */
Expand Down
5 changes: 3 additions & 2 deletions opal/mca/if/solaris_ipv6/if_solaris_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/util/string_copy.h"
#include "opal/mca/if/if.h"

static int if_solaris_ipv6_open(void);
Expand Down Expand Up @@ -96,7 +97,7 @@ static int if_solaris_ipv6_open(void)
i += sizeof (*lifreq)) {

lifreq = (struct lifreq *)((caddr_t)lifconf.lifc_buf + i);
strncpy (lifquery.lifr_name, lifreq->lifr_name,
opal_string_copy (lifquery.lifr_name, lifreq->lifr_name,
sizeof (lifquery.lifr_name));

/* lookup kernel index */
Expand Down Expand Up @@ -140,7 +141,7 @@ static int if_solaris_ipv6_open(void)
}
intf->af_family = AF_INET6;

strncpy (intf->if_name, lifreq->lifr_name, IF_NAMESIZE);
opal_string_copy (intf->if_name, lifreq->lifr_name, IF_NAMESIZE);
intf->if_index = opal_list_get_size(&opal_if_list)+1;
memcpy(&intf->if_addr, my_addr, sizeof (*my_addr));
intf->if_mask = 64;
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/pmix/ext1x/pmix1x.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "opal/util/string_copy.h"

#include "pmix1x.h"
#include "opal/mca/pmix/base/base.h"
Expand Down Expand Up @@ -124,7 +125,7 @@ static void pmix1_register_jobid(opal_jobid_t jobid, const char *nspace)
}
}
jptr = OBJ_NEW(opal_pmix1_jobid_trkr_t);
(void)strncpy(jptr->nspace, nspace, PMIX_MAX_NSLEN);
(void)opal_string_copy(jptr->nspace, nspace, PMIX_MAX_NSLEN);
jptr->jobid = jobid;
opal_list_append(&mca_pmix_ext1x_component.jobids, &jptr->super);
}
Expand Down
Loading