Ticket #19960: 0001-Use-the-correct-preprocessor-macro-for-Linux.2.patch

File 0001-Use-the-correct-preprocessor-macro-for-Linux.2.patch, 2.1 KB (added by cypherpunks, 3 years ago)
  • src/test/test_options.c

    From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
    From: cypherpunks <cypherpunks@torproject.org>
    Date: Tue, 23 Aug 2016 13:07:03 +0000
    Subject: [PATCH] Use the correct preprocessor macro for Linux
    
    Also combine all of the checks into one if-tree as only one of them
    should actually succeed.
    ---
     src/test/test_options.c | 11 ++++-------
     1 file changed, 4 insertions(+), 7 deletions(-)
    
    diff --git a/src/test/test_options.c b/src/test/test_options.c
    index 2570f8d..e85e118 100644
    a b test_options_validate__transproxy(void *ignored) 
    10711071  free_options_test_data(tdata);
    10721072  tdata = NULL;
    10731073
    1074 #if defined(linux)
     1074#if defined(__linux__)
    10751075  tdata = get_options_test_data("TransProxyType tproxy\n"
    10761076                                "TransPort 127.0.0.1:123\n");
    10771077  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
    test_options_validate__transproxy(void *ignored) 
    10791079  if (msg) {
    10801080    TT_DIE(("Expected NULL but got '%s'", msg));
    10811081  }
    1082 #endif
    1083 #ifdef KERNEL_MAY_SUPPORT_IPFW
     1082#elif defined(KERNEL_MAY_SUPPORT_IPFW)
    10841083  tdata = get_options_test_data("TransProxyType ipfw\n"
    10851084                                "TransPort 127.0.0.1:123\n");
    10861085  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
    test_options_validate__transproxy(void *ignored) 
    10881087  if (msg) {
    10891088    TT_DIE(("Expected NULL but got '%s'", msg));
    10901089  }
    1091 #endif
    1092 #if defined(__OpenBSD__)
     1090#elif defined(__OpenBSD__)
    10931091  tdata = get_options_test_data("TransProxyType pf-divert\n"
    10941092                                "TransPort 127.0.0.1:123\n");
    10951093  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
    test_options_validate__transproxy(void *ignored) 
    10971095  if (msg) {
    10981096    TT_DIE(("Expected NULL but got '%s'", msg));
    10991097  }
    1100 #endif
    1101 #if defined(__NetBSD__)
     1098#elif defined(__NetBSD__)
    11021099  tdata = get_options_test_data("TransProxyType default\n"
    11031100                                "TransPort 127.0.0.1:123\n");
    11041101  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);