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
+4 -4
View File
@@ -1009,7 +1009,7 @@ zvol_create_snap_minor_cb(const char *dsname, void *arg)
"%s is not a snapshot name\n", dsname);
} else {
minors_job_t *job;
char *n = strdup(dsname);
char *n = kmem_strdup(dsname);
if (n == NULL)
return (0);
@@ -1051,7 +1051,7 @@ zvol_create_minors_cb(const char *dsname, void *arg)
*/
if (strchr(dsname, '@') == 0) {
minors_job_t *job;
char *n = strdup(dsname);
char *n = kmem_strdup(dsname);
if (n == NULL)
return (0);
@@ -1152,7 +1152,7 @@ zvol_create_minors_impl(const char *name)
list_remove(&minors_list, job);
if (!job->error)
ops->zv_create_minor(job->name);
strfree(job->name);
kmem_strfree(job->name);
kmem_free(job, sizeof (minors_job_t));
}
@@ -1305,7 +1305,7 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
zv->zv_name[oldnamelen],
zv->zv_name + oldnamelen + 1);
ops->zv_rename_minor(zv, name);
strfree(name);
kmem_strfree(name);
}
mutex_exit(&zv->zv_state_lock);