tipcutils/backport-tipcutils-str_warnings.patch
2023-12-28 15:37:31 +08:00

92 lines
3.4 KiB
Diff

From c83051724c1d608680f0c80182533285ec10aab6 Mon Sep 17 00:00:00 2001
From: Li Shuang <shuali@redhat.com>
Date: Wed, 27 Mar 2019 11:39:04 +0800
Subject: [PATCH] tipcutils/utils: fixed several compile errors in
tipc-link-watcher.c
Conflict: NA
Reference: https://sourceforge.net/p/tipc/tipcutils/ci/c83051724c1d608680f0c80182533285ec10aab6/
---
utils/tipc-link-watcher/tipc-link-watcher.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/utils/tipc-link-watcher/tipc-link-watcher.c b/utils/tipc-link-watcher/tipc-link-watcher.c
index a24cf19..943ea4f 100644
--- a/utils/tipc-link-watcher/tipc-link-watcher.c
+++ b/utils/tipc-link-watcher/tipc-link-watcher.c
@@ -908,7 +908,7 @@ static void add_resource(const char *name,
strerror(errno));
exit(-1);
}
- strncpy(resource_p->name, name, strlen(name));
+ memcpy(resource_p->name, name, strlen(name));
*(resource) = newArray;
(*(resource))[(*count)++] = *resource_p;
}
@@ -988,7 +988,7 @@ static void uc_add_link(const char *name,
tot_mem = (*uc_dp)->mem;
/* linkstate miscellaneous */
new_link->link_misc.link_state = tot_mem;
- strncpy(new_link->link_misc.link_state, link_state, strlen(link_state));
+ memcpy(new_link->link_misc.link_state, link_state, strlen(link_state));
*(new_link->link_misc.link_state + strlen(link_state)) = '\0';
/* Make space for nos of linkstate string and null character!*/
@@ -999,7 +999,7 @@ static void uc_add_link(const char *name,
SET_MEM_AND_STEP(offset_p, step_size, tot_mem);
new_link->link_info.link = tot_mem;
- strncpy(new_link->link_info.link, name, strlen(name));
+ memcpy(new_link->link_info.link, name, strlen(name));
*(new_link->link_info.link + strlen(name)) = '\0';
tot_mem = tot_mem + (((strlen(name) + 1) + (4 - 1)) & - 4);
SET_OFFSET_AND_STEP(offset_p, 0, new_link, link_info);
@@ -1552,7 +1552,7 @@ static bool handle_getsubopt(char **optionp, char *const *tokens,
int sub_opt;
int tmp;
char *valuep;
- while (*optionp != '\0') {
+ while (*optionp != 0x0) {
sub_opt = getsubopt (optionp, tokens, &valuep);
if ((t_low < sub_opt) && (sub_opt < t_high) )
{
@@ -1596,7 +1596,7 @@ static int handle_opts(int argc, char *const argv[])
strerror(errno));
exit(-1);
}
- strncpy(r_linkp->action_list[r_linkp->action], optarg, strlen(optarg));
+ memcpy(r_linkp->action_list[r_linkp->action], optarg, strlen(optarg));
r_linkp->action++;
break;
case 'l':
@@ -1608,7 +1608,7 @@ static int handle_opts(int argc, char *const argv[])
strerror(errno));
exit(-1);
}
- strncpy(w_linkp->action_list[w_linkp->action], optarg, strlen(optarg));
+ memcpy(w_linkp->action_list[w_linkp->action], optarg, strlen(optarg));
w_linkp->action++;
break;
case 'n':
@@ -1620,7 +1620,7 @@ static int handle_opts(int argc, char *const argv[])
strerror(errno));
exit(-1);
}
- strncpy(w_nodep->action_list[w_nodep->action], optarg, strlen(optarg));
+ memcpy(w_nodep->action_list[w_nodep->action], optarg, strlen(optarg));
w_nodep->action++;
break;
case 'f':
@@ -1633,7 +1633,7 @@ static int handle_opts(int argc, char *const argv[])
strerror(errno));
exit(-1);
}
- strncpy(user_dir, optarg, strlen(optarg));
+ memcpy(user_dir, optarg, strlen(optarg));
printf(" %d \n", __LINE__);
fflush(stdout);
break;
--
2.41.0