@@ -496,7 +496,7 @@ static int _test_iov_client(int serverfd)
496496 iov [i ].iov_len = 0 ;
497497 }
498498
499- const char block_3_data [] = "make america great again! ;) " ;
499+ const char block_3_data [] = "The quick brown fox jumps over the lazy dog " ;
500500 iov [1023 ].iov_base = (void * )block_3_data ;
501501 iov [1023 ].iov_len = strlen (block_3_data );
502502
@@ -615,31 +615,31 @@ static int _test_iov_server(int clientfd)
615615 /****
616616 **** read into two bases
617617 ****/
618- const char block_3_data [] = "make america great again! ;) " ;
618+ const char block_3_data [] = "The quick brown fox jumps over the lazy dog " ;
619619
620620 for (int i = 0 ; i < ARRAY_LENGTH (iov ); ++ i ) {
621621 iov [i ].iov_base = sharedreadbuf ;
622622 iov [i ].iov_len = 0 ;
623623 }
624624
625- size_t readbuf1_size = 21 ;
625+ size_t readbuf1_size = 29 ;
626626 void * readbuf1 = calloc (1 , readbuf1_size );
627627 for (int j = 0 ; j < (readbuf1_size ); j ++ ) {
628628 ((char * )readbuf1 )[j ] = 'M' ;
629629 }
630630 iov [441 ].iov_base = readbuf1 ;
631- iov [441 ].iov_len = 12 ;
631+ iov [441 ].iov_len = 19 ;
632632
633633 // to contain data read by readv(). "- 1" to discount the
634634 // nul-terminator
635635 const size_t num_real_bytes2 = (sizeof block_3_data - 1 );
636- size_t readbuf2_size = (num_real_bytes2 - 12 ) + 5 ;
636+ size_t readbuf2_size = (num_real_bytes2 - 19 ) + 5 ;
637637 void * readbuf2 = calloc (1 , readbuf2_size );
638638 for (int j = 0 ; j < (readbuf2_size ); j ++ ) {
639639 ((char * )readbuf2 )[j ] = 'N' ;
640640 }
641641 iov [820 ].iov_base = readbuf2 ;
642- iov [820 ].iov_len = 16 ;
642+ iov [820 ].iov_len = 24 ;
643643
644644 MYLOG ("start readv()ing... " );
645645 rv = readv (clientfd , iov , ARRAY_LENGTH (iov ));
@@ -656,7 +656,7 @@ static int _test_iov_server(int clientfd)
656656 for (int i = 0 ; i < ARRAY_LENGTH (iov ); ++ i ) {
657657 if (i == 441 || i == 820 ) {
658658 // readv should not have touched the iov_len
659- const size_t expected_len = (i == 441 ) ? 12 : 16 ;
659+ const size_t expected_len = (i == 441 ) ? 19 : 24 ;
660660 if (iov [i ].iov_len != expected_len ) {
661661 LOG_ERROR_AND_RETURN (
662662 "readv produces wrong iov_len: %zu, expected: %zu" ,
@@ -669,16 +669,16 @@ static int _test_iov_server(int clientfd)
669669 }
670670 }
671671
672- if (memcmp (readbuf1 , "make america " , 12 )) {
672+ if (memcmp (readbuf1 , "The quick brown fox " , 19 )) {
673673 LOG_ERROR_AND_RETURN ("read data has incorrect bytes" );
674674 }
675- if (memcmp (readbuf1 + 12 , "MMMMMMMMM" , 9 )) {
675+ if (memcmp (readbuf1 + 19 , "MMMMMMMMM" , 9 )) {
676676 LOG_ERROR_AND_RETURN ("readv() touched more memory than it should have" );
677677 }
678- if (memcmp (readbuf2 , " great again! ;) " , 16 )) {
678+ if (memcmp (readbuf2 , " jumps over the lazy dog " , 24 )) {
679679 LOG_ERROR_AND_RETURN ("read data has incorrect bytes" );
680680 }
681- if (memcmp (readbuf2 + 16 , "NNNNN" , 5 )) {
681+ if (memcmp (readbuf2 + 24 , "NNNNN" , 5 )) {
682682 LOG_ERROR_AND_RETURN ("readv() touched more memory than it should have" );
683683 }
684684
0 commit comments