32 lines
981 B
Diff
32 lines
981 B
Diff
diff -urN a/libknet/host.c b/libknet/host.c
|
|
|
|
--- a/libknet/host.c 2021-08-04 10:17:01.912099056 +0800
|
|
+++ b/libknet/host.c 2021-08-04 10:17:55.708739020 +0800
|
|
@@ -77,7 +77,7 @@
|
|
/*
|
|
* set default host->name to host_id for logging
|
|
*/
|
|
- snprintf(host->name, KNET_MAX_HOST_LEN - 1, "%u", host_id);
|
|
+ snprintf(host->name, KNET_MAX_HOST_LEN, "%u", host_id);
|
|
|
|
/*
|
|
* initialize links internal data
|
|
@@ -226,7 +226,7 @@
|
|
}
|
|
|
|
for (host = knet_h->host_head; host != NULL; host = host->next) {
|
|
- if (!strncmp(host->name, name, KNET_MAX_HOST_LEN - 1)) {
|
|
+ if (!strncmp(host->name, name, KNET_MAX_HOST_LEN)) {
|
|
err = -1;
|
|
savederrno = EEXIST;
|
|
log_err(knet_h, KNET_SUB_HOST, "Duplicated name found on host_id %u",
|
|
@@ -235,7 +235,7 @@
|
|
}
|
|
}
|
|
|
|
- snprintf(knet_h->host_index[host_id]->name, KNET_MAX_HOST_LEN - 1, "%s", name);
|
|
+ snprintf(knet_h->host_index[host_id]->name, KNET_MAX_HOST_LEN, "%s", name);
|
|
|
|
exit_unlock:
|
|
pthread_rwlock_unlock(&knet_h->global_rwlock);
|