tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
bspwm: backport of socket unlink fix to 0.9
Sheena Artrip
9 years ago
15a51fcf
d444f80a
+64
-1
2 changed files
expand all
collapse all
unified
split
pkgs
applications
window-managers
bspwm
default.nix
unlink-socket.patch
+3
-1
pkgs/applications/window-managers/bspwm/default.nix
···
9
sha256 = "1efb2db7b8a251bcc006d66a050cf66e9d311761c94890bebf91a32905042fde";
10
};
11
0
0
12
buildInputs = [ libxcb libXinerama xcbutil xcbutilkeysyms xcbutilwm ];
13
14
buildPhase = ''
15
make PREFIX=$out
16
'';
17
-
18
installPhase = ''
19
make PREFIX=$out install
20
'';
···
9
sha256 = "1efb2db7b8a251bcc006d66a050cf66e9d311761c94890bebf91a32905042fde";
10
};
11
12
+
patches = [ ./unlink-socket.patch ];
13
+
14
buildInputs = [ libxcb libXinerama xcbutil xcbutilkeysyms xcbutilwm ];
15
16
buildPhase = ''
17
make PREFIX=$out
18
'';
19
+
20
installPhase = ''
21
make PREFIX=$out install
22
'';
+61
pkgs/applications/window-managers/bspwm/unlink-socket.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/bspwm.c b/bspwm.c
2
+
index 344e1f4..425000c 100644
3
+
--- a/bspwm.c
4
+
+++ b/bspwm.c
5
+
@@ -77,24 +77,6 @@ int main(int argc, char *argv[])
6
+
}
7
+
}
8
+
9
+
- if (config_path[0] == '\0') {
10
+
- char *config_home = getenv(CONFIG_HOME_ENV);
11
+
- if (config_home != NULL)
12
+
- snprintf(config_path, sizeof(config_path), "%s/%s/%s", config_home, WM_NAME, CONFIG_NAME);
13
+
- else
14
+
- snprintf(config_path, sizeof(config_path), "%s/%s/%s/%s", getenv("HOME"), ".config", WM_NAME, CONFIG_NAME);
15
+
- }
16
+
-
17
+
- dpy = xcb_connect(NULL, &default_screen);
18
+
-
19
+
- if (!check_connection(dpy))
20
+
- exit(EXIT_FAILURE);
21
+
-
22
+
- load_settings();
23
+
- setup();
24
+
-
25
+
- dpy_fd = xcb_get_file_descriptor(dpy);
26
+
-
27
+
char *sp = getenv(SOCKET_ENV_VAR);
28
+
if (sp != NULL) {
29
+
snprintf(socket_path, sizeof(socket_path), "%s", sp);
30
+
@@ -114,12 +96,31 @@ int main(int argc, char *argv[])
31
+
if (sock_fd == -1)
32
+
err("Couldn't create the socket.\n");
33
+
34
+
+ unlink(socket_path);
35
+
if (bind(sock_fd, (struct sockaddr *) &sock_address, sizeof(sock_address)) == -1)
36
+
err("Couldn't bind a name to the socket.\n");
37
+
38
+
if (listen(sock_fd, SOMAXCONN) == -1)
39
+
err("Couldn't listen to the socket.\n");
40
+
41
+
+ if (config_path[0] == '\0') {
42
+
+ char *config_home = getenv(CONFIG_HOME_ENV);
43
+
+ if (config_home != NULL)
44
+
+ snprintf(config_path, sizeof(config_path), "%s/%s/%s", config_home, WM_NAME, CONFIG_NAME);
45
+
+ else
46
+
+ snprintf(config_path, sizeof(config_path), "%s/%s/%s/%s", getenv("HOME"), ".config", WM_NAME, CONFIG_NAME);
47
+
+ }
48
+
+
49
+
+ dpy = xcb_connect(NULL, &default_screen);
50
+
+
51
+
+ if (!check_connection(dpy))
52
+
+ exit(EXIT_FAILURE);
53
+
+
54
+
+ load_settings();
55
+
+ setup();
56
+
+
57
+
+ dpy_fd = xcb_get_file_descriptor(dpy);
58
+
+
59
+
signal(SIGINT, sig_handler);
60
+
signal(SIGHUP, sig_handler);
61
+
signal(SIGTERM, sig_handler);