summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2022-03-31 06:34:04 +0200
committerN-R-K <79544946+N-R-K@users.noreply.github.com>2022-03-31 16:52:50 +0200
commite9468d3d3670ceddbababe312a3523f473159306 (patch)
treebcff670a89d36d4feb4d56e17581e8c5af45404e
parentbf6c0627792485bcdefe5aa055bece21ca22bbec (diff)
downloadnsxiv-e9468d3d3670ceddbababe312a3523f473159306.tar.zst
Correct setting of _NET_WM_PID
The property _NET_WM_PID is a CARDINAL which per definition has format 32, whatever the size of pid_t may be. CARDINALS (and other format 32 items) must always be passed to Xlib in long's, whatever the size of long may be.
-rw-r--r--window.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/window.c b/window.c
index df5a5a7..3c55133 100644
--- a/window.c
+++ b/window.c
@@ -189,7 +189,7 @@ void win_open(win_t *win)
int gmask;
XSizeHints sizehints;
XWMHints hints;
- pid_t pid;
+ long pid;
char hostname[256];
XSetWindowAttributes attrs;
char res_class[] = RES_CLASS;
@@ -247,7 +247,7 @@ void win_open(win_t *win)
/* set the _NET_WM_PID */
pid = getpid();
XChangeProperty(e->dpy, win->xwin, atoms[ATOM__NET_WM_PID], XA_CARDINAL,
- sizeof(pid_t) * 8, PropModeReplace, (unsigned char *) &pid, 1);
+ 32, PropModeReplace, (unsigned char *) &pid, 1);
if (gethostname(hostname, ARRLEN(hostname)) == 0) {
XTextProperty tp;
tp.value = (unsigned char *)hostname;