glib r7885 - trunk/gio
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7885 - trunk/gio
- Date: Thu, 19 Feb 2009 15:26:32 +0000 (UTC)
Author: alexl
Date: Thu Feb 19 15:26:32 2009
New Revision: 7885
URL: http://svn.gnome.org/viewvc/glib?rev=7885&view=rev
Log:
2009-02-19 Alexander Larsson <alexl redhat com>
Bug 549298 â impossible to copy files with p (pipe) flag
* gfile.c:
(file_copy_fallback):
Error out if the source file is a special file
Modified:
trunk/gio/ChangeLog
trunk/gio/gfile.c
Modified: trunk/gio/gfile.c
==============================================================================
--- trunk/gio/gfile.c (original)
+++ trunk/gio/gfile.c Thu Feb 19 15:26:32 2009
@@ -2306,19 +2306,22 @@
GFileInfo *info;
const char *target;
+ /* need to know the file type */
+ info = g_file_query_info (source,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ cancellable,
+ error);
+
+ if (info == NULL)
+ return FALSE;
+
/* Maybe copy the symlink? */
- if (flags & G_FILE_COPY_NOFOLLOW_SYMLINKS)
+ if ((flags & G_FILE_COPY_NOFOLLOW_SYMLINKS) &&
+ g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK)
{
- info = g_file_query_info (source,
- G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- cancellable,
- error);
- if (info == NULL)
- return FALSE;
-
- if (g_file_info_get_file_type (info) == G_FILE_TYPE_SYMBOLIC_LINK &&
- (target = g_file_info_get_symlink_target (info)) != NULL)
+ target = g_file_info_get_symlink_target (info);
+ if (target)
{
if (!copy_symlink (destination, flags, cancellable, target, error))
{
@@ -2329,10 +2332,23 @@
g_object_unref (info);
goto copied_file;
}
-
+ /* ... else fall back on a regular file copy */
+ g_object_unref (info);
+ }
+ /* Handle "special" files (pipes, device nodes, ...)? */
+ else if (g_file_info_get_file_type (info) == G_FILE_TYPE_SPECIAL)
+ {
+ /* FIXME: could try to recreate device nodes and others? */
+
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Can't copy special file"));
g_object_unref (info);
+ return FALSE;
}
-
+ /* Everything else should just fall back on a regular copy. */
+ else
+ g_object_unref (info);
+
in = open_source_for_copy (source, destination, flags, cancellable, error);
if (in == NULL)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]