mirror of
https://github.com/rui314/mold.git
synced 2024-12-26 01:44:29 +03:00
temporary
This commit is contained in:
parent
fe39edb1cf
commit
262608fa57
@ -1,6 +1,8 @@
|
||||
#include "mold.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -152,6 +154,8 @@ void daemonize(char **argv, std::function<void()> *wait_for_client,
|
||||
name.sun_family = AF_UNIX;
|
||||
strcpy(name.sun_path, socket_tmpfile);
|
||||
|
||||
u32 orig_mask = umask(0177);
|
||||
|
||||
if (bind(sock, (struct sockaddr *)&name, sizeof(name)) == -1) {
|
||||
if (errno != EADDRINUSE)
|
||||
Error() << "bind failed: " << strerror(errno);
|
||||
@ -161,6 +165,8 @@ void daemonize(char **argv, std::function<void()> *wait_for_client,
|
||||
Error() << "bind failed: " << strerror(errno);
|
||||
}
|
||||
|
||||
umask(orig_mask);
|
||||
|
||||
if (listen(sock, 0) == -1)
|
||||
Error() << "listen failed: " << strerror(errno);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user