--- gnome-vfs-xfer.c.ORIG	2004-12-09 20:31:14.446649232 +0530
+++ gnome-vfs-xfer.c	2004-12-09 20:40:12.501852408 +0530
@@ -1578,6 +1578,7 @@
 			GnomeVFSURI *source_uri;
 			GnomeVFSURI *dest_uri;
 			GnomeVFSFileInfo *info;
+			GnomeVFSFileInfo *targetinfo;
 			gboolean skip_child;
 
 			source_uri = NULL;
@@ -1590,6 +1591,14 @@
 				break;
 			}
 			
+			/* get target_dir URI and file info to take care of SGID */
+                        targetinfo = gnome_vfs_file_info_new ();
+                        result = gnome_vfs_get_file_info_uri (target_dir_uri, targetinfo,
+                                        GNOME_VFS_FILE_INFO_DEFAULT);
+                        if (GNOME_VFS_FILE_INFO_SGID(targetinfo))
+                                info->gid = targetinfo->gid;
+                        gnome_vfs_file_info_unref (targetinfo);
+			
 			/* Skip "." and "..".  */
 			if (strcmp (info->name, ".") != 0 && strcmp (info->name, "..") != 0) {
 
@@ -1691,6 +1700,7 @@
 		GnomeVFSURI *target_dir_uri;
 
 		GnomeVFSFileInfo *info;
+		GnomeVFSFileInfo *targetinfo;
 		gboolean skip;
 		int count;
 		int progress_result;
@@ -1713,6 +1723,18 @@
 			((GnomeVFSURI *)target_item->data);
 
 		if (result == GNOME_VFS_OK) {
+		/* get target_dir URI and file info to take care of SGID */
+			targetinfo = gnome_vfs_file_info_new ();
+			result = gnome_vfs_get_file_info_uri (target_dir_uri, targetinfo,
+					GNOME_VFS_FILE_INFO_DEFAULT);
+
+			if (GNOME_VFS_FILE_INFO_SGID(targetinfo)) {
+				info->gid = targetinfo->gid;
+			}
+			gnome_vfs_file_info_unref (targetinfo);
+		}
+	
+		if (result == GNOME_VFS_OK) {
 			/* optionally keep trying until we hit a unique target name */
 			for (count = 1; ; count++) {
 				GnomeVFSXferOverwriteMode overwrite_mode_abort;
