heap_profiler: if log_dir is empty, don't try and log to root dir!

If log_dir was empty then the prefix would be of the form /mon.a
That isn't good, so fill it in so it writes to the current dir.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
This commit is contained in:
Greg Farnum 2011-06-10 12:25:52 -07:00
parent f41773bedc
commit 52e9e5ec33

View File

@ -51,7 +51,8 @@ void ceph_heap_profiler_start()
{
char profile_name[PATH_MAX];
snprintf(profile_name, sizeof(profile_name),
"%s/%s", g_conf->log_dir.c_str(), g_conf->name.to_cstr());
"%s/%s", g_conf->log_dir.empty() ? "." : g_conf->log_dir.c_str(),
g_conf->name.to_cstr());
generic_dout(0) << "turning on heap profiler with prefix "
<< profile_name << dendl;
HeapProfilerStart(profile_name);