Philip Herron wrote:
Hey guys

I just posted the problem i had there on the irc:

23:41 < redbrain> hey guys just wondering getting an error on the latest bzr again: In function ‘ssize_t read(int, void*, size_t)’, inlined from ‘int
main(int, char**)’ at replication_event_reader.cc:156:
23:41 < redbrain> /usr/include/bits/unistd.h:43: error: call to ‘__read_chk_warn’ declared with attribute warning: read called with bigger length than size
of the destination buffer
23:41 < redbrain> i see where the error is
23:41 < redbrain> but i dont understand what its doing
23:41 < redbrain> if (read(file, &length, sizeof(uint64_t)) != sizeof(uint64_t))
23:41 < redbrain> file isnt init nor is length
23:41 < redbrain> :S
23:42 < redbrain> with this read is it trying to read a 64bit int out of a 32 bit int or somthing
23:42 < redbrain> :S
23:42 < redbrain> dont really understand
23:42 < redbrain> hmm
23:43 < redbrain> its just a compiler warning but the makefile treats it as an error


So yeah i got that error and just made this fix: Its probably not the best.. or the way its meant to work but it let me compile :)

=== modified file 'drizzled/serialize/replication_event_reader.cc'
--- drizzled/serialize/replication_event_reader.cc 2009-01-28 04:37:46 +0000 +++ drizzled/serialize/replication_event_reader.cc 2009-02-01 00:00:40 +0000
@@ -149,11 +149,11 @@
while (1)
{
off_t length;
- char *buffer= NULL;
+ char *buffer=(char*)malloc(sizeof(char));
char *temp_buffer;

/* Read the size */
- if (read(file, &length, sizeof(uint64_t)) != sizeof(uint64_t))
+ if (read(file, &length, sizeof(uint32_t)) != sizeof(uint32_t))
break;

temp_buffer= (char *)realloc(buffer, length);

=============

Anyways its probably broken with that but hey i wanted to get some merging done :)

-Phil
http://redbrain.co.uk
Hey guys

yeah just updating all you needed to to was change to:
- if (read(file, &length, sizeof(uint64_t)) != sizeof(uint64_t))
+ if (read(file, &length, sizeof(uint32_t)) != sizeof(uint32_t))

The buffer should have been left NULL.

I guess its because the length is off_t which is just: typedef long off_t
so its still 32bit and therefore too small to read a 64bit int into or something along those lines.

-Phil

http://redbrain.co.uk

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to