As it happens, even though the device reports itself as accessible in R/W,
it might not be (case in point, a loop device set up with `losetup -r`); in
this case, ntfs_open() wouldn't report any error, while ntfs_umount() would
fail with an I/O error (as sync would fail).

In such a situation, the probe has to be considered a failure.

Signed-off-by: Diego Elio Pettenò <[email protected]>
---
 src/ntfs-3g.probe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/ntfs-3g.probe.c b/src/ntfs-3g.probe.c
index 592abd7..ed9e477 100644
--- a/src/ntfs-3g.probe.c
+++ b/src/ntfs-3g.probe.c
@@ -74,7 +74,8 @@ static int ntfs_open(const char *device)
        if (!vol)
                ret = ntfs_volume_error(errno);
 
-       ntfs_umount(vol, FALSE);
+       if ( ret == 0 && ntfs_umount(vol, FALSE) == -1 )
+               ret = ntfs_volume_error(errno);
 
        return ret;
 }
-- 
1.7.8


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to