summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-02-06 18:26:20 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-02-06 18:26:20 -0800
commitf908c1e73a81baec74c1a2d312078dabd398bd06 (patch)
treec50c8520052dca72bba2522ff1051e839b9596ba
parent3006963740924fb4eff32fb513fc3306c926ead7 (diff)
vmon: suppress "(null)" name in snapshot filenames
When this code changed to use a local, potentially heap-allocated name variable, it started producing "(null)" when no -n/--name was supplied, that wasn't intended. Just use a "" name when NULL, enabling bare date-derived snapshot filenames. This seems preferable since even if you supplied an empty -n/--name you'd get a hyphen at the start of the name. I can see scenarios where you have unnamed files labeled by the output dir instead.
-rw-r--r--src/vmon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vmon.c b/src/vmon.c
index b8b6046..cc60c5c 100644
--- a/src/vmon.c
+++ b/src/vmon.c
@@ -752,7 +752,7 @@ static int vmon_snapshot(vmon_t *vmon)
strftime(start_str, sizeof(start_str), "%m.%d.%y-%T", start_time);
snprintf(path, sizeof(path), "%s/%s%s%s-%u.png",
vmon->output_dir,
- name,
+ name ? name : "",
name ? "-" : "",
start_str,
vmon->n_snapshots++);
© All Rights Reserved