summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-23 17:16:37 +0000
committerMiles Bader <miles@gnu.org>1996-09-23 17:16:37 +0000
commitc74e8f59c59ce4b3e4e9924df26ffda8af93f0c1 (patch)
tree889cba4e50c6e4c84bd7e334ac61e4885e59b902 /libdiskfs
parent8e418d55baf5cca99ed4f0bbd26cd9ab15ea7902 (diff)
(diskfs_S_fsys_get_options):
Free ARGZ if diskfs_append_args returns an error. Initialize ARGZ & ARGZ_LEN to the program name, and call diskfs_append_args instead of diskfs_get_options.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/fsys-options.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libdiskfs/fsys-options.c b/libdiskfs/fsys-options.c
index 5a8b681f..1a1786b9 100644
--- a/libdiskfs/fsys-options.c
+++ b/libdiskfs/fsys-options.c
@@ -88,8 +88,8 @@ diskfs_S_fsys_get_options (fsys_t fsys,
mach_msg_type_name_t replytype,
char **data, mach_msg_type_number_t *data_len)
{
- char *argz;
- size_t argz_len;
+ char *argz = 0;
+ size_t argz_len = 0;
error_t err;
struct port_info *port =
ports_lookup_port (diskfs_port_bucket, fsys, diskfs_control_class);
@@ -97,13 +97,19 @@ diskfs_S_fsys_get_options (fsys_t fsys,
if (!port)
return EOPNOTSUPP;
+ err = argz_add (&argz, &argz_len, program_invocation_name);
+ if (err)
+ return err;
+
rwlock_reader_lock (&diskfs_fsys_lock);
- err = diskfs_get_options (&argz, &argz_len);
+ err = diskfs_append_args (&argz, &argz_len);
rwlock_reader_unlock (&diskfs_fsys_lock);
if (! err)
/* Move ARGZ from a malloced buffer into a vm_alloced one. */
err = fshelp_return_malloced_buffer (argz, argz_len, data, data_len);
+ else
+ free (argz);
ports_port_deref (port);
return err;