Startopod / savegame-manager-gx

Automatically exported from code.google.com/p/savegame-manager-gx
0 stars 0 forks source link

Fixed a bug #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I fixed a bug when trying to copy a file less than the block size. This bug 
caused the program to hang when trying to copy the files in /hst for the 
Homebrew Channel.

--- fileops.cpp.old 2011-12-15 07:15:50.083414359 -0800
+++ fileops.cpp 2011-12-15 07:16:07.093414359 -0800
@@ -313,6 +313,15 @@
        fclose(source);
        return -3;
    }
+   
+   if (sizesrc < blksize)
+   {
+       fread(buffer, 1, sizesrc, source);
+       fwrite(buffer, 1, sizesrc, destination);
+       fclose(source);
+       fclose(destination);
+       return 1;
+   }

    u64 done = 0;

Original issue reported on code.google.com by antidote.crk@gmail.com on 15 Dec 2011 at 3:20

Attachments:

GoogleCodeExporter commented 9 years ago
nvm, for some reason it worked once, i will see whats wrong then update this 
issue.

Original comment by antidote.crk@gmail.com on 15 Dec 2011 at 3:36

Attachments:

GoogleCodeExporter commented 9 years ago
this is pretty bad, but if i comment out:
if (nbuf) free(nbuf);

in SaveManageTools.cpp it works fine. However this opens up the problem of 
memory corruption. hmm interesting dilemma here :/

Original comment by antidote.crk@gmail.com on 15 Dec 2011 at 5:11

GoogleCodeExporter commented 9 years ago
i think there is just to realloc the size of buffer

u64 sizesrc = FileSize(src);
u32 blksize = BLOCKSIZE;
u8 * buffer = (u8 *) malloc(MIN(sizesrc, blksize));

perhaps you should look around this and nothing else
thx for your help man
come on irc if you want

Original comment by dj_sk...@hotmail.com on 15 Dec 2011 at 7:25

GoogleCodeExporter commented 9 years ago
have you fixed or not?

Original comment by dj_sk...@hotmail.com on 9 Jan 2012 at 10:41

GoogleCodeExporter commented 9 years ago
sorry RL shit interrupted my debugging, My little brother was diagnosed
with Diabetes so any debugging and programming is temporarily on the back
burner.

Original comment by antidote.crk@gmail.com on 9 Jan 2012 at 10:44

GoogleCodeExporter commented 9 years ago
report if not fixed with revision 119
thx

Original comment by dj_sk...@hotmail.com on 19 Jan 2012 at 4:24