From e4f5fa12290016b2f1fd6a5b4c7e5733c788c863 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Thu, 10 Oct 2019 09:47:06 -0700 Subject: 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 Reviewed-by: Brian Behlendorf Signed-off-by: Matt Macy Closes #9433 --- module/zfs/zfs_ioctl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/zfs/zfs_ioctl.c') diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index dfd0b693e..90bc607e2 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -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)); -- cgit v1.2.3