summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/util.cc b/src/util.cc
index d5ba6fab..5a5db98d 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -403,13 +403,12 @@ dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
throw MiscError ("Unexpectedly long file");
}
- char* c = new char[len + 1];
-
FILE* f = fopen_boost (p, "r");
if (!f) {
- return "";
+ throw FileError ("could not open file", p, errno);
}
+ char* c = new char[len + 1];
fread (c, 1, len, f);
fclose (f);
c[len] = '\0';