--- gnome-vfs-2.4.0/libgnomevfs/gnome-vfs-utils.c.orig	Mon Aug 25 13:30:20 2003
+++ gnome-vfs-2.4.0/libgnomevfs/gnome-vfs-utils.c	Wed Sep 24 01:26:51 2003
@@ -762,7 +762,7 @@
  * @size:
  * 
  * Stores in @size the amount of free space on a volume.
- * This only works for local file systems with the file: scheme.
+ * This only works for URIs with the file: scheme.
  *
  * Returns: GNOME_VFS_OK on success, otherwise an error code
  */
@@ -803,12 +803,33 @@
 	statfs_result = statfs (unescaped_path, &statfs_buffer);   
 #endif  
 
-	g_free (unescaped_path);
-
 	if (statfs_result != 0) {
+		g_free (unescaped_path);
 		return gnome_vfs_result_from_errno ();
 	}
-	
+
+	/* ncpfs does not know the amount of available and free space */
+	if (statfs_buffer.f_bavail == 0 && statfs_buffer.f_bfree == 0) {
+		/* statvfs does not return f_type on ncpfs, we try again
+		 * with statfs.
+		 */
+		struct statfs statfs_buffer2;
+		statfs_result = statfs (unescaped_path, &statfs_buffer2);
+
+		if (statfs_result != 0) {
+			g_free (unescaped_path);
+			return gnome_vfs_result_from_errno ();
+		}
+		
+		/* linux/ncp_fs.h: NCP_SUPER_MAGIC == 0x564c */
+		if (statfs_buffer2.f_type == 0x564c) {
+			g_free (unescaped_path);
+			return GNOME_VFS_ERROR_NOT_SUPPORTED;
+		}
+	}
+
+	g_free (unescaped_path);
+
 	block_size = statfs_buffer.f_bsize; 
 	free_blocks = statfs_buffer.f_bavail;
 
