Re: [libposix-development] [PATCH] strncpy implementation and tests
Status: Pre-Alpha
Brought to you by:
hdante
From: Tordek <ke...@gm...> - 2009-07-04 11:51:14
|
Henrique Almeida wrote: > I've applied the patch and added those tests for a reference of a > more complete coverage. Note that with the improved coverage, an out > of bounds error was found: > > Assertion failed in file > /home/hdante/código/libposix/libposix/tests/strncpy.c, function main, > line 128: d[i] == r[i] > > So, remember to fix that bug in the strncpy implementation. There is an error on the test on the definition of r; r[6] == 0, but it's compared to d[6], which is 'g'. The assertion on line 123 shows this to be the case, and the strncpy on 125 doesn't touch it. Also, on line 101, assert(c+40 == strncpy(c+40, b, 40)); seems wrong; should't it be b+40? Fixing those errors on the test do leave the error on copying empty strings, which should be fixed by the patch. Passes all tests on my machine, please check. P.S.: Lovely printf, helped me track down the buggers ;P -- Guillermo O. «Tordek» Freschi. Programador, Escritor, Genio Maligno. http://tordek.com.ar :: http://twitter.com/tordek http://www.arcanopedia.com.ar - Juegos de Rol en Argentina |