Fixed stat(2) for system files with no data
parent
5aed8491a7
commit
23aae785c4
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue