From ab958ee752d7faa75967b3d631cf18591852a4f0 Mon Sep 17 00:00:00 2001 From: Thanos Makatos Date: Thu, 31 Mar 2016 14:20:12 +0300 Subject: [PATCH] improve error message when failing to stat block device --- persistent-data/file_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persistent-data/file_utils.cc b/persistent-data/file_utils.cc index 88ee945..4853040 100644 --- a/persistent-data/file_utils.cc +++ b/persistent-data/file_utils.cc @@ -21,7 +21,8 @@ persistent_data::get_nr_blocks(string const &path, sector_t block_size) int r = ::stat(path.c_str(), &info); if (r) - throw runtime_error("Couldn't stat dev path"); + throw runtime_error("Couldn't stat dev path " + path + ": " + + strerror(errno)); if (S_ISREG(info.st_mode) && info.st_size) nr_blocks = div_up(info.st_size, block_size);