summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/encrypted_kdm.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/encrypted_kdm.cc b/src/encrypted_kdm.cc
index 071bf870..e8e89870 100644
--- a/src/encrypted_kdm.cc
+++ b/src/encrypted_kdm.cc
@@ -707,9 +707,15 @@ void
EncryptedKDM::as_xml (boost::filesystem::path path) const
{
FILE* f = fopen_boost (path, "w");
+ if (!f) {
+ throw FileError ("Could not open KDM file for writing", path, errno);
+ }
string const x = as_xml ();
- fwrite (x.c_str(), 1, x.length(), f);
+ size_t const written = fwrite (x.c_str(), 1, x.length(), f);
fclose (f);
+ if (written != x.length()) {
+ throw FileError ("Could not write to KDM file", path, errno);
+ }
}
string