|
1 | 1 | /* |
2 | 2 | * Copyright (c) 2016-2022 IBM Corporation. All rights reserved. |
| 3 | + * Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved. |
3 | 4 | * $COPYRIGHT$ |
4 | 5 | * |
5 | 6 | * Additional copyrights may follow |
|
15 | 16 | #include <dlfcn.h> |
16 | 17 | #endif |
17 | 18 |
|
| 19 | +#include "opal/util/string_copy.h" |
18 | 20 | #include "ompi/communicator/communicator.h" |
19 | 21 | #include "ompi/mca/pml/pml.h" |
20 | 22 | #include "opal/mca/btl/btl.h" |
@@ -105,21 +107,21 @@ comm_method_string(MPI_Comm comm, int rank, int *comm_mode) { |
105 | 107 | if (comm_mode) { *comm_mode = MODE_IS_BTL; } |
106 | 108 | btl = lookup_btl_name_for_send(comm, rank); |
107 | 109 | if (NULL == btl) { |
108 | | - strncpy(string, "n/a", COMM_METHOD_STRING_SIZE); |
| 110 | + opal_string_copy(string, "n/a", COMM_METHOD_STRING_SIZE); |
109 | 111 | } else { |
110 | | - strncpy(string, btl, COMM_METHOD_STRING_SIZE); |
| 112 | + opal_string_copy(string, btl, COMM_METHOD_STRING_SIZE); |
111 | 113 | } |
112 | 114 | } |
113 | 115 | else if (p && 0==strncmp("cm", p, 3)) { // MTL |
114 | 116 | if (comm_mode) { *comm_mode = MODE_IS_MTL; } |
115 | | - strncpy(string, lookup_mtl_name(), COMM_METHOD_STRING_SIZE); |
| 117 | + opal_string_copy(string, lookup_mtl_name(), COMM_METHOD_STRING_SIZE); |
116 | 118 | } else { // PML |
117 | 119 | if (comm_mode) { *comm_mode = MODE_IS_PML; } |
118 | 120 | if (p) { |
119 | | - strncpy(string, p, COMM_METHOD_STRING_SIZE); |
| 121 | + opal_string_copy(string, p, COMM_METHOD_STRING_SIZE); |
120 | 122 | } |
121 | 123 | else { |
122 | | - strncpy(string, "n/a", COMM_METHOD_STRING_SIZE); |
| 124 | + opal_string_copy(string, "n/a", COMM_METHOD_STRING_SIZE); |
123 | 125 | } |
124 | 126 | } |
125 | 127 | } |
@@ -695,7 +697,7 @@ ompi_report_comm_methods(int called_from_location) |
695 | 697 | p = str; |
696 | 698 | for (k=0; k<nleaderranks; ++k) { |
697 | 699 | char *method_string; |
698 | | - char ucx_label[10]; |
| 700 | + char ucx_label[20]; |
699 | 701 |
|
700 | 702 | method_string = comm_method_to_string(method[i * nleaderranks + k]); |
701 | 703 | if (0 == strncmp(method_string, UCX_TAG, strlen(UCX_TAG))) { |
|
0 commit comments