From be43ff55a597bb542d1874d14ab9e5e6ba980989 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 8 Sep 2011 12:48:00 -0700 Subject: [PATCH] ceph: avoid noise when there is no output Signed-off-by: Sage Weil --- src/tools/ceph.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index 18dc7d445cbde..62ed1181cb3f8 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -188,13 +188,15 @@ int main(int argc, const char **argv) bufferlist obl; if (ceph_tool_do_command(ctx, cmd, indata, obl)) ret = 1; - int err = obl.write_fd(out_fd); - if (err) { - derr << " failed to write " << obl.length() << " bytes to " << out_file << ": " - << cpp_strerror(err) << dendl; - goto out; + if (obl.length()) { + int err = obl.write_fd(out_fd); + if (err) { + derr << " failed to write " << obl.length() << " bytes to " << out_file << ": " + << cpp_strerror(err) << dendl; + goto out; + } + derr << " wrote " << obl.length() << " byte payload to " << out_file << dendl; } - derr << " wrote " << obl.length() << " byte payload to " << out_file << dendl; } } if (ceph_tool_messenger_shutdown()) -- 2.39.5