fagensden/savegame-manager-gx

Fixed a bug

Closed this issue · 6 comments

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

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

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

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

have you fixed or not?

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

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

report if not fixed with revision 119
thx

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

  • Changed state: Fixed