JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
The code calls a function that sets errno to non-zero on failure, but does not subsequently check whether errno is equal to zero.
The functions that are subject to this checking are specified using the ERRNO_SETTING_FUNCTIONS configuration parameter.
ERRNO_SETTING_FUNCTIONS += f
| クラス名 | Missing Test of Error Code | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | Missing Test of Error Code | ||||||||||||||||||||||||||||||||||||
| クラス分類 | スタイル (style) | ||||||||||||||||||||||||||||||||||||
| ニーモニック | LANG.ERRCODE.NOTEST | ||||||||||||||||||||||||||||||||||||
| カテゴリー |
|
||||||||||||||||||||||||||||||||||||
| 対応言語 | C および C++ で利用可能です。 |
||||||||||||||||||||||||||||||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Missing Test of Error Code" |
#include <errno.h>
#include <stdio.h>
int compare_to_zero(FILE *fp){
(void) ftell(fp); /* 'Missing Test of Error Code' warning issued here
* - errno is not checked between return from this call and the next call to ftell()
*/
(void) ftell(fp); /* ok: immediately followed by check errno!=0 */
if (errno != 0){ return 1; }
(void) ftell(fp); /* ok: immediately followed by check errno==0 */
if (errno == 0) { }
else {return 1;}
(void) ftell(fp); /* 'Missing Test of Error Code' warning issued here
* - following check errno>0 is not a test for equality with zero
*/
if (errno > 0){ return 1; }
return 0;
}
int compare_to_nonzero(FILE *fp){
(void) ftell(fp); /* 'Missing Test of Error Code' warning issued here
* - following check errno==15 is not a test for equality with zero
*/
if (errno == 15){ return 1; }
return 0;
}
int not_all_paths(FILE *fp, int i){
(void) ftell(fp); /* 'Missing Test of Error Code' warning issued here
* - errno is not checked when i!=100
*/
if (i == 100){
if (errno!=0) {return 1;}
}
return 0;
}
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.