Re: Bug#248646: mc: ftpfs can't show file size larger than 2 Gigabytes



Hi,

I hope this patch incarnation is ready for production.

-- 
Regards,
Andrew V. Samoilov.
vfs/ChangeLog:

2004-0?-??  Andrew V. Samoilov  <sav bcs zp ua>

	* utilvfs.c (vfs_parse_ls_lga): Use atoll()/atof() instead of atol()
	for st_size to show file sizes > 2G.
	* fish.c (fish_dir_load): Likewise.
	* extfs.c (struct inode): Use off_t for size.

	Reported by Daradics Daniel <yotzo freemail hu>.

--- mc/vfs/utilvfs.c.bak	Mon Mar  8 09:34:31 2004
+++ mc/vfs/utilvfs.c	Fri Jul 23 14:32:30 2004
@@ -769,7 +769,11 @@ vfs_parse_ls_lga (const char *p, struct 
 	if (!is_num (idx2))
 	    goto error;
 
-	s->st_size = (size_t) atol (columns[idx2]);
+#ifdef HAVE_ATOLL
+	s->st_size = (off_t) atoll (columns[idx2]);
+#else
+	s->st_size = (off_t) atof (columns[idx2]);
+#endif
 #ifdef HAVE_STRUCT_STAT_ST_RDEV
 	s->st_rdev = 0;
 #endif
--- mc/vfs/extfs.c~	Mon Aug 30 14:40:54 2004
+++ mc/vfs/extfs.c	Mon Aug 30 14:41:16 2004
@@ -54,7 +54,7 @@ struct inode {
     mode_t mode;
     uid_t uid;
     gid_t gid;
-    int size;
+    off_t size;
     time_t mtime;
     char linkflag;
     char *linkname;
--- mc/vfs/fish.c.bak	Fri Jul 23 16:32:03 2004
+++ mc/vfs/fish.c	Fri Jul 23 17:39:30 2004
@@ -421,15 +421,18 @@ fish_dir_load(struct vfs_class *me, stru
 
 	switch(buffer[0]) {
 	case ':': {
-		      /* char *c; */
 		      if (!strcmp(buffer+1, ".") || !strcmp(buffer+1, ".."))
 			  break;  /* We'll do . and .. ourself */
 		      ent->name = g_strdup(buffer+1); 
-		      /* if ((c=strchr(ent->name, ' ')))
-			  *c = 0; / * this is ugly, but we cannot handle " " in name */
 		      break;
 	          }
-	case 'S': ST.st_size = atoi(buffer+1); break;
+	case 'S':
+#ifdef HAVE_ATOLL
+	    ST.st_size = (off_t) atoll (buffer+1);
+#else
+	    ST.st_size = (off_t) atof (buffer+1);
+#endif
+	    break;
 	case 'P': {
 	              int i;
 		      if ((i = vfs_parse_filetype(buffer[1])) ==-1)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]