FreeBSD Bugzilla – Attachment 174083 Details for
Bug 212167
listen() system call succeeds for a locally bound UNIX-domain datagram-oriented socket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Simple program that illustrates the bug
listen.c (text/plain), 561 bytes, created by
Arseny Vakhrushev
on 2016-08-26 03:21:44 UTC
(
hide
)
Description:
Simple program that illustrates the bug
Filename:
MIME Type:
Creator:
Arseny Vakhrushev
Created:
2016-08-26 03:21:44 UTC
Size:
561 bytes
patch
obsolete
>#include <err.h> >#include <string.h> >#include <unistd.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <sys/un.h> > >#define check(expr) if ((expr) == -1) err(1, "%s", #expr); > >int main(int argc, char *argv[]) { > struct sockaddr_un sun; > int fd; > > memset(&sun, 0, sizeof(sun)); > sun.sun_family = AF_LOCAL; > strncpy(sun.sun_path, "/tmp/test.sock", sizeof(sun.sun_path)); > unlink(sun.sun_path); > > check(fd = socket(sun.sun_family, SOCK_DGRAM, 0)); > check(bind(fd, (struct sockaddr *)&sun, SUN_LEN(&sun))); > check(listen(fd, 10)); > close(fd); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 212167
: 174083