mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cov: use dm_strncpy variant
This commit is contained in:
parent
cb16f5053f
commit
2a8c195360
@ -41,7 +41,7 @@ int create_temp_name(const char *dir, char *buffer, size_t len, int *fd,
|
|||||||
pid = getpid();
|
pid = getpid();
|
||||||
if (gethostname(hostname, sizeof(hostname)) < 0) {
|
if (gethostname(hostname, sizeof(hostname)) < 0) {
|
||||||
log_sys_error("gethostname", "");
|
log_sys_error("gethostname", "");
|
||||||
strcpy(hostname, "nohostname");
|
dm_strncpy(hostname, "nohostname", sizeof(hostname));
|
||||||
} else {
|
} else {
|
||||||
/* Replace any '/' with '?' found in the hostname. */
|
/* Replace any '/' with '?' found in the hostname. */
|
||||||
p = hostname;
|
p = hostname;
|
||||||
|
@ -676,11 +676,11 @@ static int _daemon_parms_init(struct cmd_context *cmd, struct daemon_parms *parm
|
|||||||
|
|
||||||
memset(parms->devicesfile, 0, sizeof(parms->devicesfile));
|
memset(parms->devicesfile, 0, sizeof(parms->devicesfile));
|
||||||
if (cmd->devicesfile) {
|
if (cmd->devicesfile) {
|
||||||
if (strlen(cmd->devicesfile) >= sizeof(parms->devicesfile)) {
|
if (!_dm_strncpy(parms->devicesfile, cmd->devicesfile,
|
||||||
|
sizeof(parms->devicesfile))) {
|
||||||
log_error("devicefile name too long for lvmpolld");
|
log_error("devicefile name too long for lvmpolld");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strcpy(parms->devicesfile, cmd->devicesfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user