libxfs: use XFS_IGET_CREATE when creating new files
Use this flag to check that newly allocated inodes are, in fact,
unallocated. This matches the kernel, and prevents userspace programs
from making latent corruptions worse by unintentionally crosslinking
files.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
diff --git a/libxfs/util.c b/libxfs/util.c
index e7d3497..8f79b0c 100644
--- a/libxfs/util.c
+++ b/libxfs/util.c
@@ -260,7 +260,7 @@
unsigned int flags;
int error;
- error = libxfs_iget(tp->t_mountp, tp, ino, 0, &ip);
+ error = libxfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, &ip);
if (error != 0)
return error;
ASSERT(ip != NULL);