Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/evfs

Dir     : e17/apps/evfs/src/plugins


Modified Files:
        evfs_fs_samba.c 


Log Message:
* Found a way around the samba<->memory packing thing
* Oops - the 'static struct' in file copy could have led to corrupt file 
transfers.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/plugins/evfs_fs_samba.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- evfs_fs_samba.c     19 Nov 2005 10:51:19 -0000      1.19
+++ evfs_fs_samba.c     19 Nov 2005 11:23:47 -0000      1.20
@@ -196,18 +196,39 @@
        int err = 0;
        int fd = 0;
        char dir[128];
+       static struct stat smb_stat;
+
        //struct stat* file_stat = calloc(1,sizeof(struct stat));
        
        
        sprintf(dir,"smb:/%s", command->file_command.files[0]->path);
        printf("Getting stat on file '%s'\n", dir);
 
-       err = smb_context->stat(smb_context, (const char*)dir, file_stat);
+       err = smb_context->stat(smb_context, (const char*)dir, &smb_stat);
        printf("Returned error code: %d\n", err);
        printf("File size: %d\n", file_stat->st_size);
        
        printf("Returning to caller..\n");
 
+       /*Ugly as shit - but if libsmbclient is compiled
+        * with a different mem packing regime, then
+        * this is the only way we can safely avoid blowing
+        * the stack (i.e we can't use memcpy) */
+       file_stat->st_dev = smb_stat.st_dev;
+       file_stat->st_ino = smb_stat.st_ino;
+       file_stat->st_mode = smb_stat.st_mode;
+       file_stat->st_nlink = smb_stat.st_nlink;
+       file_stat->st_uid = smb_stat.st_uid;
+       file_stat->st_gid = smb_stat.st_gid;
+       file_stat->st_rdev = smb_stat.st_rdev;
+       file_stat->st_size = smb_stat.st_size;
+       file_stat->st_blksize = smb_stat.st_blksize;
+       file_stat->st_blocks = smb_stat.st_blocks;
+       file_stat->st_atime = smb_stat.st_atime;
+       file_stat->st_mtime = smb_stat.st_mtime;
+       file_stat->st_ctime = smb_stat.st_ctime;
+
+
        return 0;
 
 }




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to