Add support for abstract unix socket addresses
[platform/upstream/glib.git] / gio / glocalfileinfo.c
index 9aa7331..8289ef4 100644 (file)
@@ -527,7 +527,7 @@ get_xattrs (const char            *path,
          attr2 = strchr (attr, ':');
          if (attr2)
            {
-             attr2++; /* Skip ':' */
+             attr2 += 2; /* Skip '::' */
              unescaped_attribute = hex_unescape_string (attr2, NULL, &free_unescaped_attribute);
              if (user)
                a = g_strconcat ("user.", unescaped_attribute, NULL);
@@ -825,7 +825,7 @@ _g_local_file_info_get_parent_info (const char            *dir,
 #endif
          parent_info->owner = statbuf.st_uid;
          parent_info->device = statbuf.st_dev;
-          /* No need to find trash dir if its not writable anyway */
+          /* No need to find trash dir if it's not writable anyway */
           if (parent_info->writable &&
               g_file_attribute_matcher_matches (attribute_matcher, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH))
             parent_info->has_trash_dir = _g_local_file_has_trash_dir (dir, statbuf.st_dev);
@@ -940,6 +940,8 @@ set_info_from_stat (GFileInfo             *info,
 #endif
 #if defined (HAVE_STRUCT_STAT_ST_BLOCKS)
   g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_BLOCKS, statbuf->st_blocks);
+  g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE,
+                                    statbuf->st_blocks * G_GUINT64_CONSTANT (512));
 #endif
   
   g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED, statbuf->st_mtime);
@@ -1498,7 +1500,8 @@ _g_local_file_info_get (const char             *basename,
   if (basename != NULL && basename[0] == '.')
     g_file_info_set_is_hidden (info, TRUE);
 
-  if (basename != NULL && basename[strlen (basename) -1] == '~')
+  if (basename != NULL && basename[strlen (basename) -1] == '~' &&
+      S_ISREG (statbuf.st_mode))
     g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP, TRUE);
 #else
   if (dos_attributes & FILE_ATTRIBUTE_HIDDEN)
@@ -1679,9 +1682,9 @@ _g_local_file_info_get (const char             *basename,
 }
 
 GFileInfo *
-_g_local_file_info_get_from_fd (int      fd,
-                               char    *attributes,
-                               GError **error)
+_g_local_file_info_get_from_fd (int         fd,
+                               const char *attributes,
+                               GError    **error)
 {
   GLocalFileStat stat_buf;
   GFileAttributeMatcher *matcher;
@@ -2045,7 +2048,7 @@ set_mtime_atime (char                       *filename,
 
       g_set_error (error, G_IO_ERROR,
                   g_io_error_from_errno (errsv),
-                  _("Error setting owner: %s"),
+                  _("Error setting modification or access time: %s"),
                   g_strerror (errsv));
          return FALSE;
     }
@@ -2169,7 +2172,7 @@ _g_local_file_info_set_attributes  (char                 *filename,
 #ifdef HAVE_UTIMES
   GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec;
 #endif
-#if defined (HAVE_CHOWN) && defined (HAVE_UTIMES)
+#if defined (HAVE_CHOWN) || defined (HAVE_UTIMES)
   GFileAttributeStatus status;
 #endif
   gboolean res;