summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-23 17:16:33 +0000
committerMiles Bader <miles@gnu.org>1996-09-23 17:16:33 +0000
commit8e418d55baf5cca99ed4f0bbd26cd9ab15ea7902 (patch)
treef38b1ff3d90a84eefd0c8950644a73d2e6d00e73
parent29c9ba453fd0e6777f72e1f18a55c0c193511351 (diff)
(diskfs_S_file_get_fs_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. <argz.h>: New include.
-rw-r--r--libdiskfs/file-get-fs-opts.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libdiskfs/file-get-fs-opts.c b/libdiskfs/file-get-fs-opts.c
index 662e7511..24f2f461 100644
--- a/libdiskfs/file-get-fs-opts.c
+++ b/libdiskfs/file-get-fs-opts.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <string.h>
+#include <argz.h>
#include "priv.h"
error_t
@@ -29,19 +30,25 @@ diskfs_S_file_get_fs_options (struct protid *cred,
char **data, unsigned *data_len)
{
error_t err;
- char *argz;
- size_t argz_len;
+ char *argz = 0;
+ size_t argz_len = 0;
if (! cred)
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);
return err;
}