Print better debug message for open with write mode.

This commit is contained in:
Milan Broz
2018-04-10 15:33:30 +02:00
parent f21ebaf839
commit 23b01621ff
2 changed files with 3 additions and 3 deletions

View File

@@ -436,7 +436,6 @@ static int move_keyslot_areas(struct crypt_device *cd, off_t offset_from,
devfd = device_open(device, O_RDWR);
if (devfd == -1) {
log_dbg("Cannot open device %s.", device_path(device));
free(buf);
return -EIO;
}
@@ -488,7 +487,6 @@ static int luksmeta_header_present(struct crypt_device *cd, off_t luks1_size)
devfd = device_open(device, O_RDONLY);
if (devfd == -1) {
log_dbg("Cannot open device %s.", device_path(device));
free(buf);
return -EIO;
}

View File

@@ -246,7 +246,9 @@ static int device_open_internal(struct device *device, int flags)
devfd = open(device_path(device), flags);
if (devfd < 0)
log_dbg("Cannot open device %s.", device_path(device));
log_dbg("Cannot open device %s%s.",
device_path(device),
(flags & O_ACCMODE) != O_RDONLY ? " for write" : "");
return devfd;
}