mirror of
https://github.com/ceph/ceph
synced 2025-01-03 09:32:43 +00:00
Merge pull request #2978 from majianpeng/fix4
blkdev: using strncpy instead of strcpy. Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
7d299528b5
@ -29,9 +29,11 @@ bool block_device_support_discard(const char *devname)
|
||||
{
|
||||
bool can_trim = false;
|
||||
char *p = strstr((char *)devname, "sd");
|
||||
char name[32] = {0};
|
||||
char name[32];
|
||||
|
||||
strncpy(name, p, sizeof(name) - 1);
|
||||
name[sizeof(name) - 1] = '\0';
|
||||
|
||||
strcpy(name, p);
|
||||
for (unsigned int i = 0; i < strlen(name); i++) {
|
||||
if(isdigit(name[i])) {
|
||||
name[i] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user