mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
Tests: Assert the path fits
This commit is contained in:
parent
1cdd798ac7
commit
0106647ab8
1 changed files with 2 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Assertions.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -47,7 +48,7 @@ int main(int, char**)
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
|
ASSERT(strlcpy(addr.sun_path, path, sizeof(addr.sun_path)) < sizeof(addr.sun_path));
|
||||||
|
|
||||||
rc = bind(fd, (struct sockaddr*)(&addr), sizeof(addr));
|
rc = bind(fd, (struct sockaddr*)(&addr), sizeof(addr));
|
||||||
if (rc < 0 && errno == EADDRINUSE) {
|
if (rc < 0 && errno == EADDRINUSE) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue