cdb support: design question

Matthias Andree matthias.andree at gmx.de
Fri Jul 11 02:38:44 CEST 2003


Greg Louis <glouis at dynamicro.on.ca> writes:

> It appears that Michael Tokarev's public-domain implementation of
> the cdb spec works ok, except if the cdb tool is invoked with -u while
> creating;

Confirmed & analyzed. CC'ing Michael.

tail of strace output:

open("x.tmp", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 3
...
read(4, "->\1\0\0\0\354\1771\1\n+14,8:80.134.146.179-"..., 4096) = 4096
write(3, "\2421\1\r\0\0\0\10\0\0\00080.132.42.205\2\0\0\0\356\177"..., 4096) = 4096
write(3, ".212.115\1\0\0\0\226\2421\1\16\0\0\0\10\0\0\00080.134."..., 339) = 339
lseek(3, 604440, SEEK_SET)              = 604440
read(3, 0xbfffda00, 8)                  = -1 EBADF (Bad file descriptor)

The problem is that you can't read from a file that was opened
O_WRONLY. You need to open it in O_RDWR mode to achieve this.

tinycdb 0.72.

-- 
Matthias Andree




More information about the bogofilter-dev mailing list