I believe that linux names their variables differently in the unix socket structure. I never really compiled this on linux only FreeBSD and OpenBSD. Linux actually doesn't require the sun_len variable, so go ahead and just comment out that line and it'll work fine. I'll do a patch with switches to detect if it's needed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to compile mtxorbd-1.0.2 on SuSE 7.3 and i get the following error message
system> make all
g++ -c -o action.o action.cpp
g++ -c -o protocol.o protocol.cpp
g++ -c -o device.o device.cpp
g++ -c -o mtxtype.o mtxtype.cpp
g++ -c -o connection.o connection.cpp
g++ -c -o connectionMgr.o
connectionMgr.cpp
connectionMgr.cpp: In method `int connectionMgr::InitializeEphemeril(char *)':
connectionMgr.cpp:75: `struct sockaddr_un' has no member named `sun_len'
make: *** [connectionMgr.o] Error 1
Any suggestions ?
thanks
I believe that linux names their variables differently in the unix socket structure. I never really compiled this on linux only FreeBSD and OpenBSD. Linux actually doesn't require the sun_len variable, so go ahead and just comment out that line and it'll work fine. I'll do a patch with switches to detect if it's needed.
Thanks for the advice, i commented out anything related to sun_len and it compiled properly, the client cmdline.cpp also contains sun_len links.
-----File connetionMgr.cpp--- Line 67 - 90
int connectionMgr::InitializeEphemeril(char *dev)
{
//struct sockaddr_un sun;
m_sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (m_sock < 0)
return -1;
//sun.sun_len = sizeof(sun);
//sun.sun_family = AF_LOCAL;
//strcpy(sun.sun_path, dev);
//if (bind(m_sock, (struct sockaddr *)&sun, sizeof(sun))<0)
// return -1;
if (listen(m_sock, 5))
return -1;
}
int connectionMgr::Run()
{
int blah;
//struct sockaddr_un sun;
//unsigned int size = sizeof(sun);
---------------------------------------
------File cmdline.cpp---- Line 53 - 70
int CreateConnection(char *device)
{
//struct sockaddr_un sun;
int sock;
//sun.sun_len = sizeof(sun);
//sun.sun_family = AF_LOCAL;
//strcpy(sun.sun_path, device);
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0)
return -1;
//if (connect(sock, (struct sockaddr *)&sun, sizeof(sun))<0)
// return -1;
return sock;
}
-------------------------
oh no no no, if you comment out ALL of that, then it won't open the socket correctly for communication.
You just need to comment out this line:
//sun.sun_len = sizeof(sun);
Everything else should be in the program so it properly opens the UNIX Domain Socket