mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Merge pull request #4237 from paul-elliott-arm/fix_printf_extra
Fix printf missed issues
This commit is contained in:
		
						commit
						17fbf5b3c4
					
				@ -198,7 +198,7 @@ if(CMAKE_COMPILER_IS_GNU)
 | 
				
			|||||||
        endif()
 | 
					        endif()
 | 
				
			||||||
    endif()
 | 
					    endif()
 | 
				
			||||||
    if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0)
 | 
					    if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0)
 | 
				
			||||||
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation=2")
 | 
					      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation")
 | 
				
			||||||
    endif()
 | 
					    endif()
 | 
				
			||||||
    set(CMAKE_C_FLAGS_RELEASE     "-O2")
 | 
					    set(CMAKE_C_FLAGS_RELEASE     "-O2")
 | 
				
			||||||
    set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
 | 
					    set(CMAKE_C_FLAGS_DEBUG       "-O0 -g3")
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,7 @@ int main( int argc, char *argv[] )
 | 
				
			|||||||
        if( ( ret = mbedtls_havege_random( &hs, buf, sizeof( buf ) ) ) != 0 )
 | 
					        if( ( ret = mbedtls_havege_random( &hs, buf, sizeof( buf ) ) ) != 0 )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mbedtls_printf( " failed\n  !  mbedtls_havege_random returned -0x%04X",
 | 
					            mbedtls_printf( " failed\n  !  mbedtls_havege_random returned -0x%04X",
 | 
				
			||||||
                            -ret );
 | 
					                            ( unsigned int ) -ret );
 | 
				
			||||||
            goto exit;
 | 
					            goto exit;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -142,7 +142,7 @@ static void *handle_ssl_connection( void *data )
 | 
				
			|||||||
    if( ( ret = mbedtls_ssl_setup( &ssl, thread_info->config ) ) != 0 )
 | 
					    if( ( ret = mbedtls_ssl_setup( &ssl, thread_info->config ) ) != 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_setup returned -0x%04x\n",
 | 
					        mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_setup returned -0x%04x\n",
 | 
				
			||||||
                thread_id, -ret );
 | 
					                thread_id, ( unsigned int ) -ret );
 | 
				
			||||||
        goto thread_exit;
 | 
					        goto thread_exit;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -158,7 +158,7 @@ static void *handle_ssl_connection( void *data )
 | 
				
			|||||||
        if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
					        if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_handshake returned -0x%04x\n",
 | 
					            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_handshake returned -0x%04x\n",
 | 
				
			||||||
                    thread_id, -ret );
 | 
					                    thread_id, ( unsigned int ) -ret );
 | 
				
			||||||
            goto thread_exit;
 | 
					            goto thread_exit;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -195,7 +195,7 @@ static void *handle_ssl_connection( void *data )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
                    mbedtls_printf( "  [ #%ld ]  mbedtls_ssl_read returned -0x%04x\n",
 | 
					                    mbedtls_printf( "  [ #%ld ]  mbedtls_ssl_read returned -0x%04x\n",
 | 
				
			||||||
                            thread_id, -ret );
 | 
					                            thread_id, ( unsigned int ) -ret );
 | 
				
			||||||
                    goto thread_exit;
 | 
					                    goto thread_exit;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -229,7 +229,7 @@ static void *handle_ssl_connection( void *data )
 | 
				
			|||||||
        if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
					        if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_write returned -0x%04x\n",
 | 
					            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_write returned -0x%04x\n",
 | 
				
			||||||
                    thread_id, ret );
 | 
					                    thread_id, ( unsigned int ) ret );
 | 
				
			||||||
            goto thread_exit;
 | 
					            goto thread_exit;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -246,7 +246,7 @@ static void *handle_ssl_connection( void *data )
 | 
				
			|||||||
            ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
					            ret != MBEDTLS_ERR_SSL_WANT_WRITE )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_close_notify returned -0x%04x\n",
 | 
					            mbedtls_printf( "  [ #%ld ]  failed: mbedtls_ssl_close_notify returned -0x%04x\n",
 | 
				
			||||||
                    thread_id, ret );
 | 
					                    thread_id, ( unsigned int ) ret );
 | 
				
			||||||
            goto thread_exit;
 | 
					            goto thread_exit;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -263,7 +263,7 @@ thread_exit:
 | 
				
			|||||||
        char error_buf[100];
 | 
					        char error_buf[100];
 | 
				
			||||||
        mbedtls_strerror( ret, error_buf, 100 );
 | 
					        mbedtls_strerror( ret, error_buf, 100 );
 | 
				
			||||||
        mbedtls_printf("  [ #%ld ]  Last error was: -0x%04x - %s\n\n",
 | 
					        mbedtls_printf("  [ #%ld ]  Last error was: -0x%04x - %s\n\n",
 | 
				
			||||||
               thread_id, -ret, error_buf );
 | 
					               thread_id, ( unsigned int ) -ret, error_buf );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -408,7 +408,7 @@ int main( void )
 | 
				
			|||||||
                               strlen( pers ) ) ) != 0 )
 | 
					                               strlen( pers ) ) ) != 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mbedtls_printf( " failed: mbedtls_ctr_drbg_seed returned -0x%04x\n",
 | 
					        mbedtls_printf( " failed: mbedtls_ctr_drbg_seed returned -0x%04x\n",
 | 
				
			||||||
                -ret );
 | 
					                ( unsigned int ) -ret );
 | 
				
			||||||
        goto exit;
 | 
					        goto exit;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -425,7 +425,7 @@ int main( void )
 | 
				
			|||||||
                    MBEDTLS_SSL_PRESET_DEFAULT ) ) != 0 )
 | 
					                    MBEDTLS_SSL_PRESET_DEFAULT ) ) != 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mbedtls_printf( " failed: mbedtls_ssl_config_defaults returned -0x%04x\n",
 | 
					        mbedtls_printf( " failed: mbedtls_ssl_config_defaults returned -0x%04x\n",
 | 
				
			||||||
                -ret );
 | 
					                ( unsigned int ) -ret );
 | 
				
			||||||
        goto exit;
 | 
					        goto exit;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -470,7 +470,8 @@ reset:
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        char error_buf[100];
 | 
					        char error_buf[100];
 | 
				
			||||||
        mbedtls_strerror( ret, error_buf, 100 );
 | 
					        mbedtls_strerror( ret, error_buf, 100 );
 | 
				
			||||||
        mbedtls_printf( "  [ main ]  Last error was: -0x%04x - %s\n", -ret, error_buf );
 | 
					        mbedtls_printf( "  [ main ]  Last error was: -0x%04x - %s\n", ( unsigned int ) -ret,
 | 
				
			||||||
 | 
					                        error_buf );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -482,7 +483,8 @@ reset:
 | 
				
			|||||||
    if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd,
 | 
					    if( ( ret = mbedtls_net_accept( &listen_fd, &client_fd,
 | 
				
			||||||
                                    NULL, 0, NULL ) ) != 0 )
 | 
					                                    NULL, 0, NULL ) ) != 0 )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        mbedtls_printf( "  [ main ] failed: mbedtls_net_accept returned -0x%04x\n", ret );
 | 
					        mbedtls_printf( "  [ main ] failed: mbedtls_net_accept returned -0x%04x\n",
 | 
				
			||||||
 | 
					                        ( unsigned int ) ret );
 | 
				
			||||||
        goto exit;
 | 
					        goto exit;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user