Catch bz802242 artifical zero size file segfault

This commit is contained in:
Heinz Mauelshagen 2012-03-13 12:26:35 +01:00
parent ba6984504e
commit ef7e3b7e94

View File

@ -65,7 +65,7 @@ namespace {
if (r)
throw runtime_error("Couldn't stat dev path");
if (S_ISREG(info.st_mode))
if (S_ISREG(info.st_mode) && info.st_size)
nr_blocks = div_up<block_address>(info.st_size, MD_BLOCK_SIZE);
else if (S_ISBLK(info.st_mode)) {