From: Nikolaus R. <Nik...@ra...> - 2011-05-11 03:05:53
|
Vasanth Raghavan <rag...@pu...> writes: > mynode *create_tree(off_t off, int fd) > { > char *buf; > char *node_buf; > char len_buf[2]; [..] > rc = read(fd,len_buf + num_read,sizeof(short) - num_read); In general, sizeof(short) != 2. Even if in your case sizeof(short) == 2, this really isn't a good way to write code. Either #define something like LEN_BUF_SIZE and use that in both places, or use sizeof(short) in both places. Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |