diff options
author | Miles Bader <miles@gnu.org> | 1996-06-26 21:00:20 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-06-26 21:00:20 +0000 |
commit | 1b19bb638749c62039ab4b4b8df82fd86975cfdc (patch) | |
tree | 1d9871f5f1e7b34e7b372bb40edc7ca9a1d1ae45 | |
parent | d2d5a3189b2a24014340045ddd5633c50aacfaee (diff) |
(netfs_S_file_get_fs_options):
Use fshelp_return_malloced_buffer to prepare return value.
-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; } |