From 1254b2951cf5a2da3ab38ad271ad6092c01c6db6 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 8 Nov 2005 19:49:52 +0000 Subject: [PATCH] Fix stupidness introduced in latest changesets. Thanks to Yuval for comments. --- ChangeLog | 2 +- libntfs/dir.c | 14 +++++++------- ntfsprogs/ntfsmount.c | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d689c476..610774ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,7 +71,7 @@ xx/xx/2005 - 1.12.2-WIP starting to clone or restore. (Szaka) - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. (Yura) - - Teech ntfs_create() to create special Interix files (charcter and + - Teach ntfs_create() to create special Interix files (charcter and block devices, FIFOs and sockets). Add @dev parameter to ntfs_create() for this. (Yura) diff --git a/libntfs/dir.c b/libntfs/dir.c index 2e0009f4..811f6fef 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1086,7 +1086,7 @@ err_out: * S_IFCHR to create character device * S_IFIFO to create FIFO * S_IFSOCK to create socket - * other valuer are invalid. + * other values are invalid. * * @dev is only used if @type is S_IFBLK or S_IFCHR, in other cases it's value * is ignored. @@ -1132,7 +1132,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si->last_data_change_time = utc2ntfs(ni->last_data_change_time); si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); si->last_access_time = utc2ntfs(ni->last_access_time); - if (type != S_IFREG && type != S_IFDIR) { + if (!S_ISREG(type) && !S_ISDIR(type)) { si->file_attributes = FILE_ATTR_SYSTEM; ni->flags = FILE_ATTR_SYSTEM; } @@ -1143,7 +1143,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfs_log_error("Failed to add STANDARD_INFORMATION attribute."); goto err_out; } - if (type == S_IFDIR) { + if (S_ISDIR(type)) { INDEX_ROOT *ir = NULL; INDEX_ENTRY *ie; int ir_len, index_len; @@ -1208,7 +1208,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, data = NULL; data_len = 1; break; - default: + default: /* FIFO or regular file. */ data = NULL; data_len = 0; break; @@ -1235,9 +1235,9 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, le16_to_cpu(dir_ni->mrec->sequence_number)); fn->file_name_length = name_len; fn->file_name_type = FILE_NAME_POSIX; - if (type == S_IFDIR) + if (S_ISDIR(type)) fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; - if (type != S_IFREG && type != S_IFDIR) + if (!S_ISREG(type) && !S_ISDIR(type)) fn->file_attributes = FILE_ATTR_SYSTEM; fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); @@ -1259,7 +1259,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } /* Set hard links count and directory flag. */ ni->mrec->link_count = cpu_to_le16(1); - if (type == S_IFDIR) + if (S_ISDIR(type)) ni->mrec->flags |= MFT_RECORD_IS_DIRECTORY; ntfs_inode_mark_dirty(ni); /* Done! */ diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index dd523fb2..0b5a8c67 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -782,13 +782,10 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) int stream_name_len; int res = 0; - if (mode && !(mode & - (S_IFREG | S_IFIFO | S_IFSOCK | S_IFCHR | S_IFBLK))) - return -EOPNOTSUPP; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) return stream_name_len; - if (stream_name_len && mode && !(mode & S_IFREG)) { + if (stream_name_len && !S_ISREG(mode)) { res = -EINVAL; goto exit; }