source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/err/err_prn.c@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 1.8 KB
Line 
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <stdio.h>
11#include "internal/cryptlib.h"
12#include <openssl/lhash.h>
13#include <openssl/crypto.h>
14#include <openssl/buffer.h>
15#include <openssl/err.h>
16
17void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
18 void *u)
19{
20 unsigned long l;
21 char buf[256];
22 char buf2[4096];
23 const char *file, *data;
24 int line, flags;
25 /*
26 * We don't know what kind of thing CRYPTO_THREAD_ID is. Here is our best
27 * attempt to convert it into something we can print.
28 */
29 union {
30 CRYPTO_THREAD_ID tid;
31 unsigned long ltid;
32 } tid;
33
34 tid.ltid = 0;
35 tid.tid = CRYPTO_THREAD_get_current_id();
36
37 while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
38 ERR_error_string_n(l, buf, sizeof buf);
39 BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", tid.ltid, buf,
40 file, line, (flags & ERR_TXT_STRING) ? data : "");
41 if (cb(buf2, strlen(buf2), u) <= 0)
42 break; /* abort outputting the error report */
43 }
44}
45
46static int print_bio(const char *str, size_t len, void *bp)
47{
48 return BIO_write((BIO *)bp, str, len);
49}
50
51void ERR_print_errors(BIO *bp)
52{
53 ERR_print_errors_cb(print_bio, bp);
54}
55
56#ifndef OPENSSL_NO_STDIO
57void ERR_print_errors_fp(FILE *fp)
58{
59 BIO *bio = BIO_new_fp(fp, BIO_NOCLOSE);
60 if (bio == NULL)
61 return;
62
63 ERR_print_errors_cb(print_bio, bio);
64 BIO_free(bio);
65}
66#endif
Note: See TracBrowser for help on using the repository browser.