Package: pcopy
Version: 1.5-2
Hi!
After having a lot of problems with pcopy I found several bugs in the source code:
- Missing #include <string.h>, which brakes strerror(errno) and memset(); therefore you don't get an error message opening non-existent files in line 460 (see below), but instead a segfault (see http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg1635237.html).
- write_fd = open(dstdev, O_WRONLY+O_SYNC) in line 457 does't create new files, so I suggest to use something like
if (fstat(read_fd, &read_sb) == -1)
{
fprintf(stderr, ...);
}
write_fd = creat(dstdev, read_sb.st_mode);
if (write_fd < 0)
{
fprintf(stderr, ...);
}
instead.
- The most severe bug (and I guess this leads to #484067) is the
if (write_pos =! pos) [should be of course "!="]
in line 176 when writing the new file.
I fixed these bugs (new source in attachment) and besides that I reformatted the source code and added some curly brackets in nested if-statements (so the diff is quite large and not very useful).
Cheers,
Carsten
___________________________________________________________
Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.!
http://produkte.web.de/go/02/
Attachment:
pcopy_original.c
Description: Binary data
Attachment:
pcopy_fixed.c
Description: Binary data
Attachment:
pcopy.diff
Description: Binary data