Commit e1dca468 authored by Ondrej Kozina's avatar Ondrej Kozina Committed by Milan Broz

keymanage: eliminate double close() call

fix  double close() cases in LUKS_hdr_backup() and LUKS_hdr_restore()
functions. It should be harmless unless libcryptsetup is used
in multi-thread setup which is not supported anyway.
parent b1b3d93c
Pipeline #3016501 skipped
......@@ -206,7 +206,6 @@ int LUKS_hdr_backup(const char *backup_file, struct crypt_device *ctx)
r = -EIO;
goto out;
}
close(devfd);
r = 0;
out:
......@@ -260,6 +259,7 @@ int LUKS_hdr_restore(
goto out;
}
close(devfd);
devfd = -1;
r = LUKS_read_phdr(hdr, 0, 0, ctx);
if (r == 0) {
......@@ -306,6 +306,7 @@ int LUKS_hdr_restore(
goto out;
}
close(devfd);
devfd = -1;
/* Be sure to reload new data */
r = LUKS_read_phdr(hdr, 1, 0, ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment