From bfdc5fc4fc84ef8518d2d1a328c8482cf5a38e98 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 27 Sep 2019 17:42:03 +0100 Subject: [PATCH] glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As with the previous commit, `st_mode` contains both the file type (regular file, directory, symlink, special, etc.) and the file mode. For `G_FILE_ATTRIBUTE_ID_UNIX_MODE`, we only want the file mode — so mask `st_mode` with `~S_IFMT`. Signed-off-by: Philip Withnall --- gio/glocalfileinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 487f8cc1a..dcc9bce1e 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -984,7 +984,7 @@ set_info_from_stat (GFileInfo *info, /* Mostly pointless on Windows. * Still, it allows for S_ISREG/S_ISDIR and IWRITE (read-only) checks. */ - _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_MODE, statbuf->st_mode); + _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_MODE, statbuf->st_mode & ~S_IFMT); #if defined (HAVE_STRUCT_STAT_ST_BLKSIZE) _g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_BLOCK_SIZE, statbuf->st_blksize); #endif