Hide return code check fot fallocate (that can silenty fail in this context).

This commit is contained in:
Milan Broz
2018-04-26 09:55:31 +02:00
parent 321e840c1c
commit e58883c183
2 changed files with 3 additions and 2 deletions

View File

@@ -440,7 +440,8 @@ static int move_keyslot_areas(struct crypt_device *cd, off_t offset_from,
}
/* This can safely fail (for block devices). It only allocates space if it is possible. */
posix_fallocate(devfd, offset_to, buf_size);
if (posix_fallocate(devfd, offset_to, buf_size))
log_dbg("Preallocation (fallocate) of new keyslot area not available.");
/* Try to read *new* area to check that area is there (trimmed backup). */
if (read_lseek_blockwise(devfd, device_block_size(device),

View File

@@ -900,7 +900,7 @@ static int restore_luks_header(struct reenc_ctx *rc)
stat(rc->header_file_new, &st) != -1) {
fd = open(rc->device_header, O_WRONLY);
if (fd != -1) {
posix_fallocate(fd, 0, st.st_size);
if (posix_fallocate(fd, 0, st.st_size)) {};
close(fd);
}
}