summaryrefslogtreecommitdiffstats
path: root/src/H5FDlog.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-05-28 19:54:36 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-05-28 19:54:36 (GMT)
commita67f73add8e9d8d40b71ad59434c00a606f9bec8 (patch)
tree941e98fffa2333c573978e1d740775314ae9981a /src/H5FDlog.c
parent7deefc4211612d2f9753f5c8678f2c413ef0715e (diff)
downloadhdf5-a67f73add8e9d8d40b71ad59434c00a606f9bec8.zip
hdf5-a67f73add8e9d8d40b71ad59434c00a606f9bec8.tar.gz
hdf5-a67f73add8e9d8d40b71ad59434c00a606f9bec8.tar.bz2
Normalization with develop of the VFDs and H5F package.
Diffstat (limited to 'src/H5FDlog.c')
-rw-r--r--src/H5FDlog.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 0e50df0..f649bc4 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -252,8 +252,8 @@ done:
* Purpose: Initialize this driver by registering the driver with the
* library.
*
- * Return: Success: The driver ID for the log driver.
- * Failure: Negative.
+ * Return: Success: The driver ID for the log driver
+ * Failure: H5I_INVALID_HID
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
@@ -265,7 +265,7 @@ H5FD_log_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
if(H5I_VFL != H5I_get_type(H5FD_LOG_g))
H5FD_LOG_g = H5FD_register(&H5FD_log_g, sizeof(H5FD_class_t), FALSE);
@@ -329,16 +329,24 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- /* This shallow copy is correct! The string will be properly
- * copied deep down in the H5P code.
+ HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
+
+ /* Duplicate the log file string
+ * A little wasteful, since this string will just be copied later, but
+ * passing it in as a pointer sets off a chain of impossible-to-resolve
+ * const cast warnings.
*/
- fa.logfile = (char *)logfile;
+ if(logfile != NULL && NULL == (fa.logfile = H5MM_xstrdup(logfile)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to copy log file name")
fa.flags = flags;
fa.buf_size = buf_size;
ret_value = H5P_set_driver(plist, H5FD_LOG, &fa);
done:
+ if(fa.logfile)
+ H5MM_free(fa.logfile);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fapl_log() */