Mercurial > hg > truffle
comparison src/os/bsd/vm/attachListener_bsd.cpp @ 6918:0af5da0c9d9d
8001619: Remove usage of _ALLBSD_SOURCE in bsd files
Reviewed-by: coleenp, dholmes
author | sla |
---|---|
date | Mon, 29 Oct 2012 21:04:17 +0100 |
parents | 77591ef8983a |
children | e95fc50106cf |
comparison
equal
deleted
inserted
replaced
6917:e81fbc04a942 | 6918:0af5da0c9d9d |
---|---|
340 return NULL; // log a warning? | 340 return NULL; // log a warning? |
341 } | 341 } |
342 | 342 |
343 // get the credentials of the peer and check the effective uid/guid | 343 // get the credentials of the peer and check the effective uid/guid |
344 // - check with jeff on this. | 344 // - check with jeff on this. |
345 #ifdef _ALLBSD_SOURCE | |
346 uid_t puid; | 345 uid_t puid; |
347 gid_t pgid; | 346 gid_t pgid; |
348 if (::getpeereid(s, &puid, &pgid) != 0) { | 347 if (::getpeereid(s, &puid, &pgid) != 0) { |
349 int res; | 348 int res; |
350 RESTARTABLE(::close(s), res); | 349 RESTARTABLE(::close(s), res); |
351 continue; | 350 continue; |
352 } | 351 } |
353 #else | |
354 struct ucred cred_info; | |
355 socklen_t optlen = sizeof(cred_info); | |
356 if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) { | |
357 int res; | |
358 RESTARTABLE(::close(s), res); | |
359 continue; | |
360 } | |
361 uid_t puid = cred_info.uid; | |
362 gid_t pgid = cred_info.gid; | |
363 #endif | |
364 uid_t euid = geteuid(); | 352 uid_t euid = geteuid(); |
365 gid_t egid = getegid(); | 353 gid_t egid = getegid(); |
366 | 354 |
367 if (puid != euid || pgid != egid) { | 355 if (puid != euid || pgid != egid) { |
368 int res; | 356 int res; |