Merge branch 'wip/iainl/fix-1934' into 'master'

Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"

Closes #1934

See merge request GNOME/glib!1241
This commit is contained in:
Philip Withnall 2019-11-21 11:27:20 +00:00
commit 0a469dafe4
2 changed files with 3 additions and 2 deletions

View File

@ -987,7 +987,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 & ~S_IFMT);
_g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_UNIX_MODE, statbuf->st_mode);
#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

View File

@ -929,7 +929,8 @@ test_copy_preserve_mode (void)
dest_mode = g_file_info_get_attribute_uint32 (dest_info, G_FILE_ATTRIBUTE_UNIX_MODE);
g_assert_cmpint (dest_mode, ==, vectors[i].expected_destination_mode);
g_assert_cmpint (dest_mode & ~S_IFMT, ==, vectors[i].expected_destination_mode);
g_assert_cmpint (dest_mode & S_IFMT, ==, S_IFREG);
(void) g_file_delete (tmpfile, NULL, NULL);
(void) g_file_delete (dest_tmpfile, NULL, NULL);