| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/LPdir_unix.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | struct OPENSSL_dir_context_st { | - | ||||||||||||
| 5 | DIR *dir; | - | ||||||||||||
| 6 | char entry_name[ | - | ||||||||||||
| 7 | 4096 | - | ||||||||||||
| 8 | + 1]; | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | }; | - | ||||||||||||
| 14 | - | |||||||||||||
| 15 | const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory) | - | ||||||||||||
| 16 | { | - | ||||||||||||
| 17 | struct dirent *direntry = | - | ||||||||||||
| 18 | ((void *)0) | - | ||||||||||||
| 19 | ; | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | if (ctx ==
| 0-80643 | ||||||||||||
| 22 | ((void *)0)
| 0-80643 | ||||||||||||
| 23 | || directory ==
| 0-80643 | ||||||||||||
| 24 | ((void *)0)
| 0-80643 | ||||||||||||
| 25 | ) { | - | ||||||||||||
| 26 | - | |||||||||||||
| 27 | (*__errno_location ()) | - | ||||||||||||
| 28 | = | - | ||||||||||||
| 29 | 22 | - | ||||||||||||
| 30 | ; | - | ||||||||||||
| 31 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 32 | } | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | - | |||||||||||||
| 35 | (*__errno_location ()) | - | ||||||||||||
| 36 | = 0; | - | ||||||||||||
| 37 | if (*
| 193-80450 | ||||||||||||
| 38 | ((void *)0)
| 193-80450 | ||||||||||||
| 39 | ) { | - | ||||||||||||
| 40 | *ctx = malloc(sizeof(**ctx)); | - | ||||||||||||
| 41 | if (*
| 0-193 | ||||||||||||
| 42 | ((void *)0)
| 0-193 | ||||||||||||
| 43 | ) { | - | ||||||||||||
| 44 | - | |||||||||||||
| 45 | (*__errno_location ()) | - | ||||||||||||
| 46 | = | - | ||||||||||||
| 47 | 12 | - | ||||||||||||
| 48 | ; | - | ||||||||||||
| 49 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 50 | } | - | ||||||||||||
| 51 | memset(*ctx, 0, sizeof(**ctx)); | - | ||||||||||||
| 52 | (*ctx)->dir = opendir(directory); | - | ||||||||||||
| 53 | if ((*
| 0-193 | ||||||||||||
| 54 | ((void *)0)
| 0-193 | ||||||||||||
| 55 | ) { | - | ||||||||||||
| 56 | int save_errno = | - | ||||||||||||
| 57 | (*__errno_location ()) | - | ||||||||||||
| 58 | ; | - | ||||||||||||
| 59 | free(*ctx); | - | ||||||||||||
| 60 | *ctx = | - | ||||||||||||
| 61 | ((void *)0) | - | ||||||||||||
| 62 | ; | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | (*__errno_location ()) | - | ||||||||||||
| 65 | = save_errno; | - | ||||||||||||
| 66 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 67 | } | - | ||||||||||||
| 68 | } executed 193 times by 1 test: end of blockExecuted by:
| 193 | ||||||||||||
| 69 | direntry = readdir((*ctx)->dir); | - | ||||||||||||
| 70 | if (direntry ==
| 142-80501 | ||||||||||||
| 71 | ((void *)0)
| 142-80501 | ||||||||||||
| 72 | ) { | - | ||||||||||||
| 73 | return executed 142 times by 1 test: 0;return 0;Executed by:
executed 142 times by 1 test: return 0;Executed by:
| 142 | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | - | |||||||||||||
| 77 | __builtin_strncpy ( | - | ||||||||||||
| 78 | (*ctx)->entry_name | - | ||||||||||||
| 79 | , | - | ||||||||||||
| 80 | direntry->d_name | - | ||||||||||||
| 81 | , | - | ||||||||||||
| 82 | sizeof((*ctx)->entry_name) - 1 | - | ||||||||||||
| 83 | ) | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | ; | - | ||||||||||||
| 86 | (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; | - | ||||||||||||
| 87 | return executed 80501 times by 1 test: (*ctx)->entry_name;return (*ctx)->entry_name;Executed by:
executed 80501 times by 1 test: return (*ctx)->entry_name;Executed by:
| 80501 | ||||||||||||
| 88 | } | - | ||||||||||||
| 89 | - | |||||||||||||
| 90 | int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx) | - | ||||||||||||
| 91 | { | - | ||||||||||||
| 92 | if (ctx !=
| 0-193 | ||||||||||||
| 93 | ((void *)0)
| 0-193 | ||||||||||||
| 94 | && *
| 0-193 | ||||||||||||
| 95 | ((void *)0)
| 0-193 | ||||||||||||
| 96 | ) { | - | ||||||||||||
| 97 | int ret = closedir((*ctx)->dir); | - | ||||||||||||
| 98 | - | |||||||||||||
| 99 | free(*ctx); | - | ||||||||||||
| 100 | switch (ret) { | - | ||||||||||||
| 101 | case executed 193 times by 1 test: 0:case 0:Executed by:
executed 193 times by 1 test: case 0:Executed by:
| 193 | ||||||||||||
| 102 | return executed 193 times by 1 test: 1;return 1;Executed by:
executed 193 times by 1 test: return 1;Executed by:
| 193 | ||||||||||||
| 103 | case never executed: -1:case -1:never executed: case -1: | 0 | ||||||||||||
| 104 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 105 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 106 | break; never executed: break; | 0 | ||||||||||||
| 107 | } | - | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | (*__errno_location ()) | - | ||||||||||||
| 111 | = | - | ||||||||||||
| 112 | 22 | - | ||||||||||||
| 113 | ; | - | ||||||||||||
| 114 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 115 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |