diff options
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/lib/file.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c index f3ef15cb..a4ce7b89 100644 --- a/util/nvmutil/lib/file.c +++ b/util/nvmutil/lib/file.c @@ -1001,11 +1001,8 @@ int secure_file(int *fd, goto err_secure_file; if (expected != NULL) { - if (st_now.st_dev != expected->st_dev || - st_now.st_ino != expected->st_ino) { - errno = ESTALE; + if (fd_verify_identity(*fd, expected, &st_now) < 0) goto err_secure_file; - } } *st = st_now; @@ -1052,6 +1049,11 @@ int secure_file(int *fd, if (do_lock) { if (lock_file(*fd, flags) == -1) goto err_secure_file; + + if (expected != NULL) { + if (fd_verify_identity(*fd, expected, &st_now) < 0) + goto err_secure_file; + } } if (fchmod(*fd, mode) == -1) |
