mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 19:57:43 +03:00
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:
committed by
Brian Behlendorf
parent
c5858ff946
commit
e4f5fa1229
@@ -3493,7 +3493,7 @@ zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl)
|
||||
return (SET_ERROR(EINVAL));
|
||||
(void) tsd_set(zfs_allow_log_key, NULL);
|
||||
error = spa_open(poolname, &spa, FTAG);
|
||||
strfree(poolname);
|
||||
kmem_strfree(poolname);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
@@ -4152,7 +4152,7 @@ recursive_unmount(const char *fsname, void *arg)
|
||||
|
||||
fullname = kmem_asprintf("%s@%s", fsname, snapname);
|
||||
zfs_unmount_snap(fullname);
|
||||
strfree(fullname);
|
||||
kmem_strfree(fullname);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -4688,7 +4688,7 @@ zfs_allow_log_destroy(void *arg)
|
||||
char *poolname = arg;
|
||||
|
||||
if (poolname != NULL)
|
||||
strfree(poolname);
|
||||
kmem_strfree(poolname);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -5907,8 +5907,8 @@ zfs_ioc_tmp_snapshot(zfs_cmd_t *zc)
|
||||
if (error == 0)
|
||||
(void) strlcpy(zc->zc_value, snap_name,
|
||||
sizeof (zc->zc_value));
|
||||
strfree(snap_name);
|
||||
strfree(hold_name);
|
||||
kmem_strfree(snap_name);
|
||||
kmem_strfree(hold_name);
|
||||
zfs_onexit_fd_rele(zc->zc_cleanup_fd);
|
||||
return (error);
|
||||
}
|
||||
@@ -7335,7 +7335,7 @@ zfsdev_ioctl_common(uint_t vecnum, unsigned long arg)
|
||||
goto out;
|
||||
|
||||
/* legacy ioctls can modify zc_name */
|
||||
saved_poolname = strdup(zc->zc_name);
|
||||
saved_poolname = kmem_strdup(zc->zc_name);
|
||||
if (saved_poolname == NULL) {
|
||||
error = SET_ERROR(ENOMEM);
|
||||
goto out;
|
||||
@@ -7420,11 +7420,11 @@ out:
|
||||
if (error == 0 && vec->zvec_allow_log) {
|
||||
char *s = tsd_get(zfs_allow_log_key);
|
||||
if (s != NULL)
|
||||
strfree(s);
|
||||
kmem_strfree(s);
|
||||
(void) tsd_set(zfs_allow_log_key, saved_poolname);
|
||||
} else {
|
||||
if (saved_poolname != NULL)
|
||||
strfree(saved_poolname);
|
||||
kmem_strfree(saved_poolname);
|
||||
}
|
||||
|
||||
kmem_free(zc, sizeof (zfs_cmd_t));
|
||||
|
||||
Reference in New Issue
Block a user