Hi, I've noticed that there are fileinfo trailers in many of my downloaded files. I've attached a patch which fixes the problem for me. I've moved the files back to the temporary directory and started gtkg which detects the trailer, strips it and moves the file to the completed directory. I'm not sure whether lseek() allows negative offsets but it looks safer for me this way and it also *makes* a difference. Note, that off_t is just a extended signed integer which could be 32-bit, 64-bit, 128-bit...you get the idea. I've also attached a shell script checks files for trailer, i.e. it looks whether a file contains a magic number as the last 4 bytes. Don't use it, if you don't understand what it does. There's absolutely no warranty! Note that the script works only with *one* file as parameter. Thus, if you want to check your whole directory use this:
$ find . -type f -exec chkmgc '{}' ';'
Christian
Index: fileinfo.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/fileinfo.c,v
retrieving revision 1.53
diff -u -r1.53 fileinfo.c
--- fileinfo.c 1 Feb 2003 23:16:55 -0000 1.53
+++ fileinfo.c 2 Feb 2003 14:48:42 -0000
@@ -668,7 +668,7 @@
if (buf.st_size < sizeof(tr))
return FALSE;
- if (lseek(fd, -sizeof(tr), SEEK_END) == -1) {
+ if (lseek(fd, buf.st_size - sizeof(tr), SEEK_SET) == -1) {
g_warning("file_info_get_trailer(): "
"error seek()ing in file \"%s\": %s", name, g_strerror(errno));
return FALSE;
chkmgc
Description: Binary data
msg00041/pgp00000.pgp
Description: PGP signature
