{
int status;
- char *ptr;
- size_t ptr_size;
+ char *ptr = buffer;
+ size_t ptr_size = buffer_size;
time_t now;
struct tm struct_tm;
- status = FORMAT_VL (buffer, buffer_size, vl);
+ if (datadir != NULL)
+ {
+ size_t len = strlen (datadir) + 1;
+
+ if (len >= ptr_size)
+ return (ENOBUFS);
+
+ memcpy (ptr, datadir, len);
+ ptr[len-1] = '/';
+ ptr_size -= len;
+ ptr += len;
+ }
+
+ status = FORMAT_VL (ptr, ptr_size, vl);
if (status != 0)
return (status);
if (use_stdio)
return (0);
- ptr_size = buffer_size - strlen (buffer);
- ptr = buffer + strlen (buffer);
+ ptr_size -= strlen (ptr);
+ ptr += strlen (ptr);
/* "-2013-07-12" => 11 bytes */
if (ptr_size < 12)