Merge "Fsync directories after creating files"
diff --git a/cryptfs.cpp b/cryptfs.cpp
index 28facac..d661952 100644
--- a/cryptfs.cpp
+++ b/cryptfs.cpp
@@ -1144,6 +1144,7 @@
char buffer[DM_CRYPT_BUF_SIZE];
struct dm_ioctl* io;
int retval = -1;
+ int err;
if ((fd = open("/dev/device-mapper", O_RDWR | O_CLOEXEC)) < 0) {
SLOGE("Cannot open device-mapper\n");
@@ -1153,8 +1154,9 @@
io = (struct dm_ioctl*)buffer;
ioctl_init(io, DM_CRYPT_BUF_SIZE, name, 0);
- if (ioctl(fd, DM_DEV_REMOVE, io)) {
- SLOGE("Cannot remove dm-crypt device\n");
+ err = ioctl(fd, DM_DEV_REMOVE, io);
+ if (err) {
+ SLOGE("Cannot remove dm-crypt device %s: %s\n", name, strerror(errno));
goto errout;
}