| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bss_file.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | static int file_write(BIO *h, const char *buf, int num); | - | ||||||||||||||||||||||||
| 6 | static int file_read(BIO *h, char *buf, int size); | - | ||||||||||||||||||||||||
| 7 | static int file_puts(BIO *h, const char *str); | - | ||||||||||||||||||||||||
| 8 | static int file_gets(BIO *h, char *str, int size); | - | ||||||||||||||||||||||||
| 9 | static long file_ctrl(BIO *h, int cmd, long arg1, void *arg2); | - | ||||||||||||||||||||||||
| 10 | static int file_new(BIO *h); | - | ||||||||||||||||||||||||
| 11 | static int file_free(BIO *data); | - | ||||||||||||||||||||||||
| 12 | static const BIO_METHOD methods_filep = { | - | ||||||||||||||||||||||||
| 13 | ( 2|0x0400), | - | ||||||||||||||||||||||||
| 14 | "FILE pointer", | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | bwrite_conv, | - | ||||||||||||||||||||||||
| 17 | file_write, | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | bread_conv, | - | ||||||||||||||||||||||||
| 20 | file_read, | - | ||||||||||||||||||||||||
| 21 | file_puts, | - | ||||||||||||||||||||||||
| 22 | file_gets, | - | ||||||||||||||||||||||||
| 23 | file_ctrl, | - | ||||||||||||||||||||||||
| 24 | file_new, | - | ||||||||||||||||||||||||
| 25 | file_free, | - | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | ((void *)0) | - | ||||||||||||||||||||||||
| 28 | , | - | ||||||||||||||||||||||||
| 29 | }; | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | BIO *BIO_new_file(const char *filename, const char *mode) | - | ||||||||||||||||||||||||
| 32 | { | - | ||||||||||||||||||||||||
| 33 | BIO *ret; | - | ||||||||||||||||||||||||
| 34 | FILE *file = openssl_fopen(filename, mode); | - | ||||||||||||||||||||||||
| 35 | int fp_flags = 0x01; | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | if ( | - | ||||||||||||||||||||||||
| 38 | (
| 0-9803 | ||||||||||||||||||||||||
| 39 | 'b'
| 0-9803 | ||||||||||||||||||||||||
| 40 | )
| 0-9803 | ||||||||||||||||||||||||
| 41 | mode
| 0-9803 | ||||||||||||||||||||||||
| 42 | )
| 0-9803 | ||||||||||||||||||||||||
| 43 | 'b'
| 0-9803 | ||||||||||||||||||||||||
| 44 | ) == '\0'
| 0-9803 | ||||||||||||||||||||||||
| 45 | mode
| 4705-5098 | ||||||||||||||||||||||||
| 46 | ,
| 4705-5098 | ||||||||||||||||||||||||
| 47 | 'b'
| 4705-5098 | ||||||||||||||||||||||||
| 48 | ) : __builtin_strchr (
| 4705-5098 | ||||||||||||||||||||||||
| 49 | mode
| 4705-5098 | ||||||||||||||||||||||||
| 50 | ,
| 4705-5098 | ||||||||||||||||||||||||
| 51 | 'b'
| 4705-5098 | ||||||||||||||||||||||||
| 52 | )))
| 4705-5098 | ||||||||||||||||||||||||
| 53 | ==
| 4705-5098 | ||||||||||||||||||||||||
| 54 | ((void *)0)
| 4705-5098 | ||||||||||||||||||||||||
| 55 | ) | - | ||||||||||||||||||||||||
| 56 | fp_flags |= 0x10; executed 4705 times by 1 test: fp_flags |= 0x10;Executed by:
| 4705 | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | if (file ==
| 2540-7263 | ||||||||||||||||||||||||
| 59 | ((void *)0)
| 2540-7263 | ||||||||||||||||||||||||
| 60 | ) { | - | ||||||||||||||||||||||||
| 61 | ERR_put_error(2,(1),( | - | ||||||||||||||||||||||||
| 62 | (*__errno_location ()) | - | ||||||||||||||||||||||||
| 63 | ),__FILE__,72); | - | ||||||||||||||||||||||||
| 64 | ERR_add_error_data(5, "fopen('", filename, "','", mode, "')"); | - | ||||||||||||||||||||||||
| 65 | if ( | - | ||||||||||||||||||||||||
| 66 | (*
| 1-2539 | ||||||||||||||||||||||||
| 67 | ==
| 1-2539 | ||||||||||||||||||||||||
| 68 | 2
| 1-2539 | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | || | - | ||||||||||||||||||||||||
| 72 | (*
| 0-1 | ||||||||||||||||||||||||
| 73 | ==
| 0-1 | ||||||||||||||||||||||||
| 74 | 6
| 0-1 | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | ) | - | ||||||||||||||||||||||||
| 78 | ERR_put_error(32,(109),(128),__FILE__,79); executed 2539 times by 1 test: ERR_put_error(32,(109),(128),__FILE__,79);Executed by:
| 2539 | ||||||||||||||||||||||||
| 79 | else | - | ||||||||||||||||||||||||
| 80 | ERR_put_error(32,(109),(2),__FILE__,81); executed 1 time by 1 test: ERR_put_error(32,(109),(2),__FILE__,81);Executed by:
| 1 | ||||||||||||||||||||||||
| 81 | return executed 2540 times by 1 test: return ((void *)0) ;Executed by:
executed 2540 times by 1 test: return ((void *)0) ;Executed by:
| 2540 | ||||||||||||||||||||||||
| 82 | ((void *)0) executed 2540 times by 1 test: return ((void *)0) ;Executed by:
| 2540 | ||||||||||||||||||||||||
| 83 | ; executed 2540 times by 1 test: return ((void *)0) ;Executed by:
| 2540 | ||||||||||||||||||||||||
| 84 | } | - | ||||||||||||||||||||||||
| 85 | if ((
| 0-7263 | ||||||||||||||||||||||||
| 86 | ((void *)0)
| 0-7263 | ||||||||||||||||||||||||
| 87 | ) { | - | ||||||||||||||||||||||||
| 88 | fclose(file); | - | ||||||||||||||||||||||||
| 89 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 90 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 91 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 92 | } | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | BIO_clear_flags(ret, 0); | - | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | BIO_ctrl(ret,106,fp_flags,(char *)(file)); | - | ||||||||||||||||||||||||
| 97 | return executed 7263 times by 1 test: ret;return ret;Executed by:
executed 7263 times by 1 test: return ret;Executed by:
| 7263 | ||||||||||||||||||||||||
| 98 | } | - | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | BIO *BIO_new_fp(FILE *stream, int close_flag) | - | ||||||||||||||||||||||||
| 101 | { | - | ||||||||||||||||||||||||
| 102 | BIO *ret; | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | if ((
| 0-10202 | ||||||||||||||||||||||||
| 105 | ((void *)0)
| 0-10202 | ||||||||||||||||||||||||
| 106 | ) | - | ||||||||||||||||||||||||
| 107 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 108 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 109 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | BIO_set_flags(ret, 0); | - | ||||||||||||||||||||||||
| 113 | BIO_ctrl(ret,106,close_flag,(char *)(stream)); | - | ||||||||||||||||||||||||
| 114 | return executed 10202 times by 12 tests: ret;return ret;Executed by:
executed 10202 times by 12 tests: return ret;Executed by:
| 10202 | ||||||||||||||||||||||||
| 115 | } | - | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | const BIO_METHOD *BIO_s_file(void) | - | ||||||||||||||||||||||||
| 118 | { | - | ||||||||||||||||||||||||
| 119 | return executed 22400 times by 12 tests: &methods_filep;return &methods_filep;Executed by:
executed 22400 times by 12 tests: return &methods_filep;Executed by:
| 22400 | ||||||||||||||||||||||||
| 120 | } | - | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | static int file_new(BIO *bi) | - | ||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||
| 124 | bi->init = 0; | - | ||||||||||||||||||||||||
| 125 | bi->num = 0; | - | ||||||||||||||||||||||||
| 126 | bi->ptr = | - | ||||||||||||||||||||||||
| 127 | ((void *)0) | - | ||||||||||||||||||||||||
| 128 | ; | - | ||||||||||||||||||||||||
| 129 | bi->flags = 0; | - | ||||||||||||||||||||||||
| 130 | return executed 22400 times by 12 tests: 1;return 1;Executed by:
executed 22400 times by 12 tests: return 1;Executed by:
| 22400 | ||||||||||||||||||||||||
| 131 | } | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | static int file_free(BIO *a) | - | ||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||
| 135 | if (a ==
| 0-44800 | ||||||||||||||||||||||||
| 136 | ((void *)0)
| 0-44800 | ||||||||||||||||||||||||
| 137 | ) | - | ||||||||||||||||||||||||
| 138 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 139 | if (a->shutdown
| 10140-34660 | ||||||||||||||||||||||||
| 140 | if ((
| 0-22400 | ||||||||||||||||||||||||
| 141 | ((void *)0)
| 0-12260 | ||||||||||||||||||||||||
| 142 | )
| 0-12260 | ||||||||||||||||||||||||
| 143 | if (a->flags & 0
| 0-12260 | ||||||||||||||||||||||||
| 144 | fclose(a->ptr); never executed: fclose(a->ptr); | 0 | ||||||||||||||||||||||||
| 145 | else | - | ||||||||||||||||||||||||
| 146 | fclose(a->ptr); executed 12260 times by 1 test: fclose(a->ptr);Executed by:
| 12260 | ||||||||||||||||||||||||
| 147 | a->ptr = | - | ||||||||||||||||||||||||
| 148 | ((void *)0) | - | ||||||||||||||||||||||||
| 149 | ; | - | ||||||||||||||||||||||||
| 150 | a->flags = 0; | - | ||||||||||||||||||||||||
| 151 | } executed 12260 times by 1 test: end of blockExecuted by:
| 12260 | ||||||||||||||||||||||||
| 152 | a->init = 0; | - | ||||||||||||||||||||||||
| 153 | } executed 34660 times by 12 tests: end of blockExecuted by:
| 34660 | ||||||||||||||||||||||||
| 154 | return executed 44800 times by 12 tests: 1;return 1;Executed by:
executed 44800 times by 12 tests: return 1;Executed by:
| 44800 | ||||||||||||||||||||||||
| 155 | } | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | static int file_read(BIO *b, char *out, int outl) | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | int ret = 0; | - | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | if (b->init
| 0-7006 | ||||||||||||||||||||||||
| 162 | ((void *)0)
| 0-7006 | ||||||||||||||||||||||||
| 163 | )
| 0-7006 | ||||||||||||||||||||||||
| 164 | if (b->flags & 0
| 0-7006 | ||||||||||||||||||||||||
| 165 | ret = fread(out, 1, (int)outl, b->ptr); never executed: ret = fread(out, 1, (int)outl, b->ptr); | 0 | ||||||||||||||||||||||||
| 166 | else | - | ||||||||||||||||||||||||
| 167 | ret = fread(out, 1, (int)outl, (FILE *)b->ptr); executed 7006 times by 1 test: ret = fread(out, 1, (int)outl, (FILE *)b->ptr);Executed by:
| 7006 | ||||||||||||||||||||||||
| 168 | if (ret == 0
| 0-7006 | ||||||||||||||||||||||||
| 169 | && (
| 0-7006 | ||||||||||||||||||||||||
| 170 | ferror((FILE *)b->ptr)
| 0-7006 | ||||||||||||||||||||||||
| 171 | ERR_put_error(2,(11),( | - | ||||||||||||||||||||||||
| 172 | (*__errno_location ()) | - | ||||||||||||||||||||||||
| 173 | ),__FILE__,152); | - | ||||||||||||||||||||||||
| 174 | ERR_put_error(32,(130),(2),__FILE__,153); | - | ||||||||||||||||||||||||
| 175 | ret = -1; | - | ||||||||||||||||||||||||
| 176 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 177 | } executed 7006 times by 1 test: end of blockExecuted by:
| 7006 | ||||||||||||||||||||||||
| 178 | return executed 7006 times by 1 test: ret;return ret;Executed by:
executed 7006 times by 1 test: return ret;Executed by:
| 7006 | ||||||||||||||||||||||||
| 179 | } | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | static int file_write(BIO *b, const char *in, int inl) | - | ||||||||||||||||||||||||
| 182 | { | - | ||||||||||||||||||||||||
| 183 | int ret = 0; | - | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | if (b->init
| 0-413449 | ||||||||||||||||||||||||
| 186 | ((void *)0)
| 0-413449 | ||||||||||||||||||||||||
| 187 | )
| 0-413449 | ||||||||||||||||||||||||
| 188 | if (b->flags & 0
| 0-413449 | ||||||||||||||||||||||||
| 189 | ret = fwrite(in, (int)inl, 1, b->ptr); never executed: ret = fwrite(in, (int)inl, 1, b->ptr); | 0 | ||||||||||||||||||||||||
| 190 | else | - | ||||||||||||||||||||||||
| 191 | ret = fwrite(in, (int)inl, 1, (FILE *)b->ptr); executed 413449 times by 12 tests: ret = fwrite(in, (int)inl, 1, (FILE *)b->ptr);Executed by:
| 413449 | ||||||||||||||||||||||||
| 192 | if (ret
| 0-413449 | ||||||||||||||||||||||||
| 193 | ret = inl; executed 413449 times by 12 tests: ret = inl;Executed by:
| 413449 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | } executed 413449 times by 12 tests: end of blockExecuted by:
| 413449 | ||||||||||||||||||||||||
| 201 | return executed 413449 times by 12 tests: ret;return ret;Executed by:
executed 413449 times by 12 tests: return ret;Executed by:
| 413449 | ||||||||||||||||||||||||
| 202 | } | - | ||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | static long file_ctrl(BIO *b, int cmd, long num, void *ptr) | - | ||||||||||||||||||||||||
| 205 | { | - | ||||||||||||||||||||||||
| 206 | long ret = 1; | - | ||||||||||||||||||||||||
| 207 | FILE *fp = (FILE *)b->ptr; | - | ||||||||||||||||||||||||
| 208 | FILE **fpp; | - | ||||||||||||||||||||||||
| 209 | char p[4]; | - | ||||||||||||||||||||||||
| 210 | int st; | - | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | switch (cmd) { | - | ||||||||||||||||||||||||
| 213 | case never executed: 128:case 128:never executed: case 128: | 0 | ||||||||||||||||||||||||
| 214 | case executed 5 times by 1 test: 1:case 1:Executed by:
executed 5 times by 1 test: case 1:Executed by:
| 5 | ||||||||||||||||||||||||
| 215 | if (b->flags & 0
| 0-5 | ||||||||||||||||||||||||
| 216 | ret = (long)fseek(b->ptr, num, 0); never executed: ret = (long)fseek(b->ptr, num, 0); | 0 | ||||||||||||||||||||||||
| 217 | else | - | ||||||||||||||||||||||||
| 218 | ret = (long)fseek(fp, num, 0); executed 5 times by 1 test: ret = (long)fseek(fp, num, 0);Executed by:
| 5 | ||||||||||||||||||||||||
| 219 | break; executed 5 times by 1 test: break;Executed by:
| 5 | ||||||||||||||||||||||||
| 220 | case executed 11122 times by 1 test: 2:case 2:Executed by:
executed 11122 times by 1 test: case 2:Executed by:
| 11122 | ||||||||||||||||||||||||
| 221 | if (b->flags & 0
| 0-11122 | ||||||||||||||||||||||||
| 222 | ret = (long)feof(fp); never executed: ret = (long)feof(fp); | 0 | ||||||||||||||||||||||||
| 223 | else | - | ||||||||||||||||||||||||
| 224 | ret = (long)feof(fp); executed 11122 times by 1 test: ret = (long)feof(fp);Executed by:
| 11122 | ||||||||||||||||||||||||
| 225 | break; executed 11122 times by 1 test: break;Executed by:
| 11122 | ||||||||||||||||||||||||
| 226 | case never executed: 133:case 133:never executed: case 133: | 0 | ||||||||||||||||||||||||
| 227 | case never executed: 3:case 3:never executed: case 3: | 0 | ||||||||||||||||||||||||
| 228 | if (b->flags & 0
| 0 | ||||||||||||||||||||||||
| 229 | ret = ftell(b->ptr); never executed: ret = ftell(b->ptr); | 0 | ||||||||||||||||||||||||
| 230 | else | - | ||||||||||||||||||||||||
| 231 | ret = ftell(fp); never executed: ret = ftell(fp); | 0 | ||||||||||||||||||||||||
| 232 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 233 | case executed 17465 times by 12 tests: 106:case 106:Executed by:
executed 17465 times by 12 tests: case 106:Executed by:
| 17465 | ||||||||||||||||||||||||
| 234 | file_free(b); | - | ||||||||||||||||||||||||
| 235 | b->shutdown = (int)num & 0x01; | - | ||||||||||||||||||||||||
| 236 | b->ptr = ptr; | - | ||||||||||||||||||||||||
| 237 | b->init = 1; | - | ||||||||||||||||||||||||
| 238 | { | - | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | break; executed 17465 times by 12 tests: break;Executed by:
| 17465 | ||||||||||||||||||||||||
| 241 | case executed 4935 times by 1 test: 108:case 108:Executed by:
executed 4935 times by 1 test: case 108:Executed by:
| 4935 | ||||||||||||||||||||||||
| 242 | file_free(b); | - | ||||||||||||||||||||||||
| 243 | b->shutdown = (int)num & 0x01; | - | ||||||||||||||||||||||||
| 244 | if (num & 0x08
| 0-4935 | ||||||||||||||||||||||||
| 245 | if (num & 0x02
| 0 | ||||||||||||||||||||||||
| 246 | OPENSSL_strlcpy(p, "a+", sizeof(p)); never executed: OPENSSL_strlcpy(p, "a+", sizeof(p)); | 0 | ||||||||||||||||||||||||
| 247 | else | - | ||||||||||||||||||||||||
| 248 | OPENSSL_strlcpy(p, "a", sizeof(p)); never executed: OPENSSL_strlcpy(p, "a", sizeof(p)); | 0 | ||||||||||||||||||||||||
| 249 | } else if ((
| 0-4935 | ||||||||||||||||||||||||
| 250 | OPENSSL_strlcpy(p, "r+", sizeof(p)); never executed: OPENSSL_strlcpy(p, "r+", sizeof(p)); | 0 | ||||||||||||||||||||||||
| 251 | else if (num & 0x04
| 0-4935 | ||||||||||||||||||||||||
| 252 | OPENSSL_strlcpy(p, "w", sizeof(p)); never executed: OPENSSL_strlcpy(p, "w", sizeof(p)); | 0 | ||||||||||||||||||||||||
| 253 | else if (num & 0x02
| 0-4935 | ||||||||||||||||||||||||
| 254 | OPENSSL_strlcpy(p, "r", sizeof(p)); executed 4935 times by 1 test: OPENSSL_strlcpy(p, "r", sizeof(p));Executed by:
| 4935 | ||||||||||||||||||||||||
| 255 | else { | - | ||||||||||||||||||||||||
| 256 | ERR_put_error(32,(116),(101),__FILE__,278); | - | ||||||||||||||||||||||||
| 257 | ret = 0; | - | ||||||||||||||||||||||||
| 258 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 259 | } | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | fp = openssl_fopen(ptr, p); | - | ||||||||||||||||||||||||
| 267 | if (fp ==
| 0-4935 | ||||||||||||||||||||||||
| 268 | ((void *)0)
| 0-4935 | ||||||||||||||||||||||||
| 269 | ) { | - | ||||||||||||||||||||||||
| 270 | ERR_put_error(2,(1),( | - | ||||||||||||||||||||||||
| 271 | (*__errno_location ()) | - | ||||||||||||||||||||||||
| 272 | ),__FILE__,290); | - | ||||||||||||||||||||||||
| 273 | ERR_add_error_data(5, "fopen('", ptr, "','", p, "')"); | - | ||||||||||||||||||||||||
| 274 | ERR_put_error(32,(116),(2),__FILE__,292); | - | ||||||||||||||||||||||||
| 275 | ret = 0; | - | ||||||||||||||||||||||||
| 276 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | b->ptr = fp; | - | ||||||||||||||||||||||||
| 279 | b->init = 1; | - | ||||||||||||||||||||||||
| 280 | BIO_clear_flags(b, 0); | - | ||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | break; executed 4935 times by 1 test: break;Executed by:
| 4935 | ||||||||||||||||||||||||
| 283 | case executed 2 times by 1 test: 107:case 107:Executed by:
executed 2 times by 1 test: case 107:Executed by:
| 2 | ||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | if (ptr !=
| 0-2 | ||||||||||||||||||||||||
| 286 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
| 287 | ) { | - | ||||||||||||||||||||||||
| 288 | fpp = (FILE **)ptr; | - | ||||||||||||||||||||||||
| 289 | *fpp = (FILE *)b->ptr; | - | ||||||||||||||||||||||||
| 290 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 291 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||||||||
| 292 | case never executed: 8:case 8:never executed: case 8: | 0 | ||||||||||||||||||||||||
| 293 | ret = (long)b->shutdown; | - | ||||||||||||||||||||||||
| 294 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 295 | case never executed: 9:case 9:never executed: case 9: | 0 | ||||||||||||||||||||||||
| 296 | b->shutdown = (int)num; | - | ||||||||||||||||||||||||
| 297 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 298 | case executed 32247 times by 12 tests: 11:case 11:Executed by:
executed 32247 times by 12 tests: case 11:Executed by:
| 32247 | ||||||||||||||||||||||||
| 299 | st = b->flags & 0
| 0-32247 | ||||||||||||||||||||||||
| 300 | ? fflush(b->ptr) : fflush((FILE *)b->ptr); | - | ||||||||||||||||||||||||
| 301 | if (st ==
| 0-32247 | ||||||||||||||||||||||||
| 302 | (-1)
| 0-32247 | ||||||||||||||||||||||||
| 303 | ) { | - | ||||||||||||||||||||||||
| 304 | ERR_put_error(2,(18),( | - | ||||||||||||||||||||||||
| 305 | (*__errno_location ()) | - | ||||||||||||||||||||||||
| 306 | ),__FILE__,318); | - | ||||||||||||||||||||||||
| 307 | ERR_add_error_data(1, "fflush()"); | - | ||||||||||||||||||||||||
| 308 | ERR_put_error(32,(116),(2),__FILE__,320); | - | ||||||||||||||||||||||||
| 309 | ret = 0; | - | ||||||||||||||||||||||||
| 310 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 311 | break; executed 32247 times by 12 tests: break;Executed by:
| 32247 | ||||||||||||||||||||||||
| 312 | case never executed: 12:case 12:never executed: case 12: | 0 | ||||||||||||||||||||||||
| 313 | ret = 1; | - | ||||||||||||||||||||||||
| 314 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | case never executed: 13:case 13:never executed: case 13: | 0 | ||||||||||||||||||||||||
| 317 | case never executed: 10:case 10:never executed: case 10: | 0 | ||||||||||||||||||||||||
| 318 | case executed 2774 times by 12 tests: 6:case 6:Executed by:
executed 2774 times by 12 tests: case 6:Executed by:
| 2774 | ||||||||||||||||||||||||
| 319 | case executed 240 times by 1 test: 7:case 7:Executed by:
executed 240 times by 1 test: case 7:Executed by:
| 240 | ||||||||||||||||||||||||
| 320 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 321 | ret = 0; | - | ||||||||||||||||||||||||
| 322 | break; executed 3014 times by 12 tests: break;Executed by:
| 3014 | ||||||||||||||||||||||||
| 323 | } | - | ||||||||||||||||||||||||
| 324 | return executed 68790 times by 12 tests: ret;return ret;Executed by:
executed 68790 times by 12 tests: return ret;Executed by:
| 68790 | ||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | static int file_gets(BIO *bp, char *buf, int size) | - | ||||||||||||||||||||||||
| 328 | { | - | ||||||||||||||||||||||||
| 329 | int ret = 0; | - | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | buf[0] = '\0'; | - | ||||||||||||||||||||||||
| 332 | if (bp->flags & 0
| 0-376779 | ||||||||||||||||||||||||
| 333 | if (!fgets(buf, size, bp->ptr)
| 0 | ||||||||||||||||||||||||
| 334 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 335 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 336 | if (!fgets(buf, size, (FILE *)bp->ptr)
| 6349-370430 | ||||||||||||||||||||||||
| 337 | goto executed 6349 times by 1 test: err;goto err;Executed by:
executed 6349 times by 1 test: goto err;Executed by:
| 6349 | ||||||||||||||||||||||||
| 338 | } executed 370430 times by 1 test: end of blockExecuted by:
| 370430 | ||||||||||||||||||||||||
| 339 | if (buf[0] != '\0'
| 0-370430 | ||||||||||||||||||||||||
| 340 | ret = strlen(buf); executed 370430 times by 1 test: ret = strlen(buf);Executed by:
| 370430 | ||||||||||||||||||||||||
| 341 | err: code before this statement executed 370430 times by 1 test: err:Executed by:
| 370430 | ||||||||||||||||||||||||
| 342 | return executed 376779 times by 1 test: ret;return ret;Executed by:
executed 376779 times by 1 test: return ret;Executed by:
| 376779 | ||||||||||||||||||||||||
| 343 | } | - | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | static int file_puts(BIO *bp, const char *str) | - | ||||||||||||||||||||||||
| 346 | { | - | ||||||||||||||||||||||||
| 347 | int n, ret; | - | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | n = strlen(str); | - | ||||||||||||||||||||||||
| 350 | ret = file_write(bp, str, n); | - | ||||||||||||||||||||||||
| 351 | return executed 37333 times by 1 test: ret;return ret;Executed by:
executed 37333 times by 1 test: return ret;Executed by:
| 37333 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |