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

File 0001-Use-the-correct-preprocessor-macro-for-Linux.patch, 1.6 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 | 8 +++-----
     1 file changed, 3 insertions(+), 5 deletions(-)
    
    diff --git a/src/test/test_options.c b/src/test/test_options.c
    index 87f8966..6a24fd6 100644
    a b test_options_validate__transproxy(void *ignored) 
    10791079  free_options_test_data(tdata);
    10801080  tdata = NULL;
    10811081
    1082 #if defined(linux)
     1082#if defined(__linux__)
    10831083  tdata = get_options_test_data("TransProxyType tproxy\n"
    10841084                                "TransPort 127.0.0.1:123\n");
    10851085  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
    10861086  tt_int_op(ret, OP_EQ, -1);
    10871087  tt_assert(!msg);
    1088 #endif
    1089 #if defined(__FreeBSD_kernel__) || defined( DARWIN )
     1088#elif defined(__FreeBSD_kernel__) || defined( DARWIN )
    10901089  tdata = get_options_test_data("TransProxyType ipfw\n"
    10911090                                "TransPort 127.0.0.1:123\n");
    10921091  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
    10931092  tt_int_op(ret, OP_EQ, -1);
    10941093  tt_assert(!msg);
    1095 #endif
    1096 #if defined(__OpenBSD__)
     1094#elif defined(__OpenBSD__)
    10971095  tdata = get_options_test_data("TransProxyType pf-divert\n"
    10981096                                "TransPort 127.0.0.1:123\n");
    10991097  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);