From 0a918f567f3b9743240f493366ae40b18dc6ded4 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 1 Jan 2007 17:02:27 +0000 Subject: [PATCH] fix: invalid argument error when writing randomly into sparse files --- libntfs-3g/attrib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 848905e8..f870e6cb 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -977,6 +977,8 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs, rlc++; if (rlc->lcn >= 0) { lcn_seek_from = rlc->lcn - (rlc->vcn - from_vcn); + if (lcn_seek_from < -1) + lcn_seek_from = -1; break; } }