orte: strncpy() -> opal_string_copy()
Fairly straightforward conversion of strncpy() calls to opal_string_copy(). Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
родитель
cef6cf0ac5
Коммит
a85bad37df
@ -11,7 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -26,6 +26,7 @@
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
|
||||
#include "orte/mca/rml/base/base.h"
|
||||
#include "orte/util/threads.h"
|
||||
@ -109,7 +110,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_recv_t);
|
||||
_s->hdr.tag = (m)->tag; \
|
||||
_s->hdr.seq_num = (m)->seq_num; \
|
||||
if (NULL != (m)->routed) { \
|
||||
(void)strncpy(_s->hdr.routed, (m)->routed, \
|
||||
(void)opal_string_copy(_s->hdr.routed, (m)->routed, \
|
||||
ORTE_MAX_RTD_SIZE); \
|
||||
} \
|
||||
/* point to the actual message */ \
|
||||
@ -157,7 +158,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_recv_t);
|
||||
_s->hdr.tag = (m)->tag; \
|
||||
_s->hdr.seq_num = (m)->seq_num; \
|
||||
if (NULL != (m)->routed) { \
|
||||
(void)strncpy(_s->hdr.routed, (m)->routed, \
|
||||
(void)opal_string_copy(_s->hdr.routed, (m)->routed, \
|
||||
ORTE_MAX_RTD_SIZE); \
|
||||
} \
|
||||
/* point to the actual message */ \
|
||||
@ -202,7 +203,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_recv_t);
|
||||
_s->hdr.dst = (m)->hdr.dst; \
|
||||
_s->hdr.type = MCA_OOB_TCP_USER; \
|
||||
_s->hdr.tag = (m)->hdr.tag; \
|
||||
(void)strncpy(_s->hdr.routed, (m)->hdr.routed, \
|
||||
(void)opal_string_copy(_s->hdr.routed, (m)->hdr.routed, \
|
||||
ORTE_MAX_RTD_SIZE); \
|
||||
/* point to the actual message */ \
|
||||
_s->data = (m)->data; \
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2010 Oracle and/or its affiliates. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2011 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2015-2018 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -45,6 +45,7 @@
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/basename.h"
|
||||
#include "opal/util/path.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
|
||||
#include "orte/mca/state/state.h"
|
||||
#include "orte/util/name_fns.h"
|
||||
@ -365,8 +366,7 @@ char **orte_plm_rsh_search(const char* agent_list, const char *path)
|
||||
if (NULL == path) {
|
||||
getcwd(cwd, OPAL_PATH_MAX);
|
||||
} else {
|
||||
strncpy(cwd, path, OPAL_PATH_MAX - 1);
|
||||
cwd[OPAL_PATH_MAX - 1] = '\0';
|
||||
opal_string_copy(cwd, path, OPAL_PATH_MAX);
|
||||
}
|
||||
if (NULL == agent_list) {
|
||||
lines = opal_argv_split(mca_plm_rsh_component.agent, ':');
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
#include "orte/mca/mca.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/hwloc/base/base.h"
|
||||
#include "opal/dss/dss.h"
|
||||
@ -530,14 +531,14 @@ void orte_rmaps_base_display_map(orte_job_t *jdata)
|
||||
memset(tmp1, 0, sizeof(tmp1));
|
||||
if (orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) {
|
||||
if (NULL == bd) {
|
||||
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
(void)opal_string_copy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
} else {
|
||||
if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(tmp1, sizeof(tmp1), node->topology->topo, bd->cpuset)) {
|
||||
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
(void)opal_string_copy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(void)strncpy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
(void)opal_string_copy(tmp1, "UNBOUND", sizeof(tmp1));
|
||||
}
|
||||
opal_output(orte_clean_output, "\t\t<process rank=%s app_idx=%ld local_rank=%lu node_rank=%lu binding=%s>",
|
||||
ORTE_VPID_PRINT(proc->name.vpid), (long)proc->app_idx,
|
||||
|
@ -9,6 +9,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Evergrid, Inc. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -28,6 +29,7 @@
|
||||
#include "opal/util/opal_environ.h"
|
||||
#include "opal/util/basename.h"
|
||||
#include "opal/util/show_help.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
#include "orte/mca/mca.h"
|
||||
#include "opal/mca/base/base.h"
|
||||
#include "opal/mca/crs/crs.h"
|
||||
@ -1381,7 +1383,7 @@ static void snapc_full_process_request_op_cmd(orte_process_name_t* sender,
|
||||
ORTE_ERROR_LOG(ret);
|
||||
goto cleanup;
|
||||
}
|
||||
strncpy( ((datum->mig_host_pref)[i]), tmp_str, OPAL_MAX_PROCESSOR_NAME);
|
||||
opal_string_copy( ((datum->mig_host_pref)[i]), tmp_str, OPAL_MAX_PROCESSOR_NAME);
|
||||
|
||||
count = 1;
|
||||
if (ORTE_SUCCESS != (ret = opal_dss.unpack(sbuffer, &((datum->mig_vpid_pref)[i]), &count, OPAL_INT))) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
@ -72,6 +72,7 @@
|
||||
#include "opal/util/opal_getcwd.h"
|
||||
#include "opal/util/show_help.h"
|
||||
#include "opal/util/fd.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
#include "opal/sys/atomic.h"
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
#include "opal/runtime/opal_cr.h"
|
||||
@ -2295,7 +2296,8 @@ static void orte_debugger_init_before_spawn(orte_job_t *jdata)
|
||||
free(attach_fifo);
|
||||
return;
|
||||
}
|
||||
strncpy(MPIR_attach_fifo, attach_fifo, MPIR_MAX_PATH_LENGTH - 1);
|
||||
opal_string_copy(MPIR_attach_fifo, attach_fifo,
|
||||
MPIR_MAX_PATH_LENGTH);
|
||||
free(attach_fifo);
|
||||
open_fifo();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved
|
||||
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
@ -28,6 +28,8 @@
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "opal/util/string_copy.h"
|
||||
|
||||
#include <pmix_tool.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -47,7 +49,7 @@ int main(int argc, char **argv)
|
||||
/* query something */
|
||||
ninfo = 1;
|
||||
PMIX_INFO_CREATE(info, ninfo);
|
||||
(void)strncpy(info[0].key, PMIX_QUERY_NAMESPACES, PMIX_MAX_KEYLEN);
|
||||
(void)opal_string_copy(info[0].key, PMIX_QUERY_NAMESPACES, PMIX_MAX_KEYLEN);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Query_info(info, ninfo))) {
|
||||
fprintf(stderr, "Tool ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -15,6 +16,7 @@
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
|
||||
@ -187,7 +189,8 @@ int orte_attr_register(const char *project,
|
||||
for (i = 0 ; i < MAX_CONVERTERS ; ++i) {
|
||||
if (0 == converters[i].init) {
|
||||
converters[i].init = 1;
|
||||
strncpy(converters[i].project, project, MAX_CONVERTER_PROJECT_LEN);
|
||||
opal_string_copy(converters[i].project, project,
|
||||
MAX_CONVERTER_PROJECT_LEN);
|
||||
converters[i].project[MAX_CONVERTER_PROJECT_LEN-1] = '\0';
|
||||
converters[i].key_base = key_base;
|
||||
converters[i].key_max = key_max;
|
||||
|
@ -13,6 +13,7 @@
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016-2018 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -27,6 +28,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "opal/util/printf.h"
|
||||
#include "opal/util/string_copy.h"
|
||||
#include "opal/threads/tsd.h"
|
||||
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
@ -292,7 +294,7 @@ int orte_util_snprintf_jobid(char *jobid_string, size_t size, const orte_jobid_t
|
||||
|
||||
/* check for wildcard value - handle appropriately */
|
||||
if (ORTE_JOBID_WILDCARD == jobid) {
|
||||
(void)strncpy(jobid_string, ORTE_SCHEMA_WILDCARD_STRING, size);
|
||||
(void)opal_string_copy(jobid_string, ORTE_SCHEMA_WILDCARD_STRING, size);
|
||||
} else {
|
||||
rc = snprintf(jobid_string, size, "%ld", (long) jobid);
|
||||
if (0 > rc) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user