Skip to content
Snippets Groups Projects
Unverified Commit 5ef57a52 authored by Jake Drahos's avatar Jake Drahos
Browse files

Fixed socket umask

parent af685ab9
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/stat.h>
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h> #include <bluetooth/rfcomm.h>
#include <pthread.h> #include <pthread.h>
...@@ -139,6 +140,7 @@ int main(int argc, char **argv) ...@@ -139,6 +140,7 @@ int main(int argc, char **argv)
unlink(backend_socket_path); unlink(backend_socket_path);
/* Create socket */ /* Create socket */
mode_t old_umask = umask(0000);
backendSocket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); backendSocket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
if (backendSocket < 0) { if (backendSocket < 0) {
err(-1, "socket"); err(-1, "socket");
...@@ -152,6 +154,7 @@ int main(int argc, char **argv) ...@@ -152,6 +154,7 @@ int main(int argc, char **argv)
if (bind(backendSocket, (struct sockaddr *) &sa, sizeof(sa))) { if (bind(backendSocket, (struct sockaddr *) &sa, sizeof(sa))) {
err(-1, "bind"); err(-1, "bind");
} }
umask(old_umask);
/* Listen */ /* Listen */
if (listen(backendSocket, 16)) { if (listen(backendSocket, 16)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment