@@ -1732,6 +1732,7 @@ _ostree_stbuf_to_gfileinfo (const struct stat *stbuf)
17321732 g_file_info_set_attribute_uint32 (ret , "unix::uid" , stbuf -> st_uid );
17331733 g_file_info_set_attribute_uint32 (ret , "unix::gid" , stbuf -> st_gid );
17341734 g_file_info_set_attribute_uint32 (ret , "unix::mode" , mode );
1735+ g_file_info_set_attribute_uint32 (ret , "unix::rdev" , stbuf -> st_rdev );
17351736
17361737 /* those aren't stored by ostree, but used by the devino cache */
17371738 g_file_info_set_attribute_uint32 (ret , "unix::device" , stbuf -> st_dev );
@@ -1816,6 +1817,22 @@ _ostree_stbuf_equal (struct stat *stbuf_a, struct stat *stbuf_b)
18161817 return TRUE;
18171818}
18181819
1820+ /* Check if stbuf belongs to a whiteout character device */
1821+ gboolean
1822+ _ostree_stbuf_is_whiteout (struct stat * stbuf )
1823+ {
1824+ return S_ISCHR (stbuf -> st_mode ) && stbuf -> st_rdev == 0 ;
1825+ }
1826+
1827+ /* Check if GFileInfo belongs to a whiteout character device */
1828+ gboolean
1829+ _ostree_gfileinfo_is_whiteout (GFileInfo * file_info )
1830+ {
1831+ struct stat stbuf ;
1832+ _ostree_gfileinfo_to_stbuf (file_info , & stbuf );
1833+ return _ostree_stbuf_is_whiteout (& stbuf );
1834+ }
1835+
18191836/* Many parts of libostree only care about mode,uid,gid - this creates
18201837 * a new GFileInfo with those fields see.
18211838 */
@@ -2014,7 +2031,7 @@ file_header_parse (GVariant *metadata,
20142031 mode = GUINT32_FROM_BE (mode );
20152032 g_autoptr (GFileInfo ) ret_file_info = _ostree_mode_uidgid_to_gfileinfo (mode , uid , gid );
20162033
2017- if (S_ISREG (mode ) || S_ISCHR ( mode ))
2034+ if (S_ISREG (mode ) || _ostree_gfileinfo_is_whiteout ( ret_file_info ))
20182035 {
20192036 ;
20202037 }
@@ -2065,7 +2082,7 @@ zlib_file_header_parse (GVariant *metadata,
20652082 g_autoptr (GFileInfo ) ret_file_info = _ostree_mode_uidgid_to_gfileinfo (mode , uid , gid );
20662083 g_file_info_set_size (ret_file_info , GUINT64_FROM_BE (size ));
20672084
2068- if (S_ISREG (mode ) || S_ISCHR ( mode ))
2085+ if (S_ISREG (mode ) || _ostree_gfileinfo_is_whiteout ( ret_file_info ))
20692086 {
20702087 ;
20712088 }
0 commit comments