MFC: revs 1.23 and 1.24
* Replace fch{mod,own} with straight ch{mod,own} as the former cannot be used on socket file descriptors * Open permissions on /var/run/devd.pipe so that any user can read devd events from this socket * Enable non-blocking I/O on devd.pipe to keep clients from wedging devd. If a write(2) on devd.pipe would block, the client in question will be removed Approved by: re (kensmith)
This commit is contained in:
parent
12391a1891
commit
2acfae159d
@ -672,11 +672,13 @@ create_socket(const char *name)
|
||||
strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
|
||||
slen = SUN_LEN(&sun);
|
||||
unlink(name);
|
||||
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
|
||||
err(1, "fcntl");
|
||||
if (bind(fd, (struct sockaddr *) & sun, slen) < 0)
|
||||
err(1, "bind");
|
||||
listen(fd, 4);
|
||||
fchown(fd, 0, 0); /* XXX - root.wheel */
|
||||
fchmod(fd, 0660);
|
||||
chown(name, 0, 0); /* XXX - root.wheel */
|
||||
chmod(name, 0660);
|
||||
return (fd);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user