Skip to content

Commit 001c956

Browse files
committed
updated for platform choose
1 parent 8a4b3c8 commit 001c956

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/eapauth/SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
env = DefaultEnvironment()
22
env.AppendUnique(CCFLAGS=['-O2', '-std=c++11'])
33

4+
import platform
5+
if platform.system() == "Darwin":
6+
env.AppendUnique(CPPDEFINES=['SYSTEM_DARWIN'])
7+
elif platform.system() == "Linux":
8+
env.AppendUnique(CPPDEFINES=['SYSTEM_LINUX'])
9+
410
env.StaticLibrary('eapauth',
511
[
612
'eapauth.cpp',

src/eapauth/eaputils.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ EAPClient::EAPClient(const std::string &iface) {
3737

3838
mac_addr_t mac_addr;
3939

40-
#ifdef SYSTEM_LINUX
40+
#ifdef SYSTEM_LINUX
4141
if ((client_fd = socket(AF_PACKET, SOCK_RAW, htons(ETHERTYPE_PAE))) < 0) {
4242
perror("socket");
4343
abort();
@@ -83,8 +83,8 @@ EAPClient::EAPClient(const std::string &iface) {
8383
abort();
8484
}
8585

86-
#elif SYSTEM_DARWIN // FOR Darwin
87-
86+
#elif SYSTEM_DARWIN // FOR Darwin
87+
8888
if ((bpf_fd = open("/dev/bpf1", O_RDWR)) < 0) {
8989
perror("open");
9090
abort();
@@ -138,7 +138,9 @@ EAPClient::EAPClient(const std::string &iface) {
138138

139139
this->timeout.tv_sec = 30;
140140
this->timeout.tv_usec = 0;
141-
#endif
141+
#else
142+
#error SYSUH3C doesn't support your platform.
143+
#endif
142144

143145
// Generate ethernet header
144146

0 commit comments

Comments
 (0)