make a 'runtests' make target that runs some 'unit test'-like tests. Fix crash when uid's without a password entry are encountered, return the uid as a string instead.

This commit is contained in:
Arnout Engelen
2012-03-15 22:31:28 +00:00
parent 2c04ca9267
commit 4ff973bbd7
11 changed files with 284 additions and 229 deletions

View File

@@ -60,13 +60,14 @@ void getLocal (const char *device, bool tracemode)
struct ifreq iFreq;
struct sockaddr_in *saddr;
if((sock=socket(AF_INET, SOCK_RAW, htons(0x0806)))<0){
forceExit("creating socket failed while establishing local IP - are you root?", -3);
}
if((sock=socket(AF_INET, SOCK_RAW, htons(0x0806)))<0)
forceExit(false, "creating socket failed while establishing local IP - are you root?");
strcpy(iFreq.ifr_name, device);
if(ioctl(sock, SIOCGIFADDR, &iFreq)<0){
forceExit("ioctl failed while establishing local IP for selected device %s. You may specify the device on the command line.", -4, device);
}
if(ioctl(sock, SIOCGIFADDR, &iFreq)<0)
forceExit(false, "ioctl failed while establishing local IP for selected device %s. You may specify the device on the command line.", device);
saddr=(struct sockaddr_in*)&iFreq.ifr_addr;
local_addrs = new local_addr (saddr->sin_addr.s_addr, local_addrs);