From 23aae785c43e53bb7c1d780461507dd64e1b39d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 25 Oct 2010 12:13:28 +0200 Subject: [PATCH] Fixed stat(2) for system files with no data --- src/lowntfs-3g.c | 4 +++- src/ntfs-3g.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index d351d83e..65422461 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -709,7 +709,8 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, if (ni->flags & FILE_ATTR_SYSTEM) { na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - goto exit; + stbuf->st_ino = ni->mft_no; + goto nodata; } /* Check whether it's Interix FIFO or socket. */ if (!(ni->flags & FILE_ATTR_HIDDEN)) { @@ -779,6 +780,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx, } if (S_ISLNK(stbuf->st_mode)) stbuf->st_mode |= 0777; +nodata : stbuf->st_ino = ni->mft_no; #ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC stbuf->st_atimespec = ntfs2timespec(ni->last_access_time); diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 2946ab91..ccd1f888 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -783,9 +783,11 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); if (!na) { - if (stream_name_len) + if (stream_name_len) { res = -ENOENT; - goto exit; + goto exit; + } else + goto nodata; } if (stream_name_len) { stbuf->st_size = na->data_size; @@ -869,6 +871,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) } if (S_ISLNK(stbuf->st_mode)) stbuf->st_mode |= 0777; +nodata : stbuf->st_ino = ni->mft_no; #ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC stbuf->st_atimespec = ntfs2timespec(ni->last_access_time);