[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix log.c comments about assert vs tor_assert vs raw_assert.



commit 219f6ea51640cca6abcca8d913188724212d107e
Merge: 2bc4c55d7 d9bfc9e2e
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Aug 28 15:58:16 2018 -0400

    Fix log.c comments about assert vs tor_assert vs raw_assert.

 doc/tor.1.txt                  |  2 +-
 src/feature/hs/hs_config.c     | 24 ++++++++++++++++++
 src/feature/hs/hs_service.c    | 57 ++++++++++++++++++++++++++++++++++++++++--
 src/feature/hs/hs_service.h    |  3 ++-
 src/feature/relay/routerkeys.c | 21 ++++++++++------
 src/feature/relay/routerkeys.h |  3 ++-
 src/feature/rend/rendservice.c | 23 +++++++++++++++++
 src/feature/rend/rendservice.h |  1 +
 src/lib/log/log.c              |  9 ++++---
 src/test/test_routerkeys.c     | 36 +++++++++++++-------------
 10 files changed, 145 insertions(+), 34 deletions(-)

diff --cc src/lib/log/log.c
index e2514a341,e2514a341..d60ce6308
--- a/src/lib/log/log.c
+++ b/src/lib/log/log.c
@@@ -101,7 -101,7 +101,7 @@@ sev_to_string(int severity
      case LOG_NOTICE:  return "notice";
      case LOG_WARN:    return "warn";
      case LOG_ERR:     return "err";
--    default:     /* Call assert, not tor_assert, since tor_assert
++    default:     /* Call raw_assert, not tor_assert, since tor_assert
                    * calls log on failure. */
                   raw_assert_unreached(); return "UNKNOWN"; // LCOV_EXCL_LINE
    }
@@@ -122,7 -122,7 +122,8 @@@ should_log_function_name(log_domain_mas
        /* We care about places where bugs occur. */
        return (domain & (LD_BUG|LD_NOFUNCNAME)) == LD_BUG;
      default:
--      /* Call assert, not tor_assert, since tor_assert calls log on failure. */
++      /* Call raw_assert, not tor_assert, since tor_assert calls
++       * log on failure. */
        raw_assert(0); return 0; // LCOV_EXCL_LINE
    }
  }
@@@ -579,7 -579,7 +580,7 @@@ logv,(int severity, log_domain_mask_t d
    char *end_of_prefix=NULL;
    int callbacks_deferred = 0;
  
--  /* Call assert, not raw_assert, since raw_assert calls log on failure. */
++  /* Call raw_assert, not tor_assert, since tor_assert calls log on failure. */
    raw_assert(format);
    /* check that severity is sane.  Overrunning the masks array leads to
     * interesting and hard to diagnose effects */
@@@ -694,7 -694,7 +695,7 @@@ tor_log_update_sigsafe_err_fds(void
    if (!found_real_stderr &&
        int_array_contains(fds, n_fds, STDOUT_FILENO)) {
      /* Don't use a virtual stderr when we're also logging to stdout. */
--    raw_assert(n_fds >= 2); /* Don't raw_assert inside log fns */
++    raw_assert(n_fds >= 2); /* Don't tor_assert inside log fns */
      fds[0] = fds[--n_fds];
    }
  

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits