diff options
Diffstat (limited to 'libnetfs')
-rw-r--r-- | libnetfs/file-get-fs-options.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libnetfs/file-get-fs-options.c b/libnetfs/file-get-fs-options.c index 358d76f4..8d4af76b 100644 --- a/libnetfs/file-get-fs-options.c +++ b/libnetfs/file-get-fs-options.c @@ -34,7 +34,8 @@ netfs_S_file_get_fs_options (struct protid *user, char **data, mach_msg_type_number_t *data_len) { error_t err; - char *argz = 0; + char *argz; + size_t argz_len; if (! user) return EOPNOTSUPP; @@ -42,20 +43,14 @@ netfs_S_file_get_fs_options (struct protid *user, #if NOT_YET rwlock_reader_lock (&netfs_fsys_lock); #endif - err = netfs_get_options (&argz, data_len); + err = netfs_get_options (&argz, &argz_len); #if NOT_YET rwlock_reader_unlock (&netfs_fsys_lock); #endif - if (!err && *data_len > 0) + if (! err) /* Move ARGZ from a malloced buffer into a vm_alloced one. */ - { - err = - vm_allocate (mach_task_self (), (vm_address_t *)data, *data_len, 1); - if (!err) - bcopy (argz, *data, *data_len); - free (argz); - } + err = fshelp_return_malloced_buffer (argz, argz_len, data, data_len); return err; } |