Fix strdup conflict on other platforms

In the FreeBSD kernel the strdup signature is:

```
char	*strdup(const char *__restrict, struct malloc_type *);
```

It's unfortunate that the developers have chosen to change
the signature of libc functions - but it's what I have to
deal with.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9433
This commit is contained in:
Matthew Macy
2019-10-10 09:47:06 -07:00
committed by Brian Behlendorf
parent c5858ff946
commit e4f5fa1229
21 changed files with 76 additions and 75 deletions
+6 -6
View File
@@ -137,8 +137,8 @@ zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa,
se = kmem_zalloc(sizeof (zfs_snapentry_t), KM_SLEEP);
se->se_name = strdup(full_name);
se->se_path = strdup(full_path);
se->se_name = kmem_strdup(full_name);
se->se_path = kmem_strdup(full_path);
se->se_spa = spa;
se->se_objsetid = objsetid;
se->se_root_dentry = root_dentry;
@@ -157,8 +157,8 @@ static void
zfsctl_snapshot_free(zfs_snapentry_t *se)
{
zfs_refcount_destroy(&se->se_refcount);
strfree(se->se_name);
strfree(se->se_path);
kmem_strfree(se->se_name);
kmem_strfree(se->se_path);
kmem_free(se, sizeof (zfs_snapentry_t));
}
@@ -311,8 +311,8 @@ zfsctl_snapshot_rename(char *old_snapname, char *new_snapname)
return (SET_ERROR(ENOENT));
zfsctl_snapshot_remove(se);
strfree(se->se_name);
se->se_name = strdup(new_snapname);
kmem_strfree(se->se_name);
se->se_name = kmem_strdup(new_snapname);
zfsctl_snapshot_add(se);
zfsctl_snapshot_rele(se);