diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-11-21 23:35:15 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-11-21 23:35:15 +0100 |
commit | 407dc8b5e6a4db430381000256c87ba313bbed5e (patch) | |
tree | 6d30de84132f70586af80fc0e346a8ac8f92703e /src | |
parent | 1ecaccd77c18036d8ff4c137487aa8c5a04d2b36 (diff) | |
download | ratpoison-407dc8b5e6a4db430381000256c87ba313bbed5e.zip |
Don't assume getsid succeeds, fixes %p "glitches"
* on eg. OpenBSD you get -1 with errno set to EPERM if you call getsid
on a pid no in the same session group as you. This makes the session
id check much less useful, and exhibits glitches with %p in winfmt.
For now, just bail out if getsid fails...
Diffstat (limited to 'src')
-rw-r--r-- | src/window.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index 15024f6..8955919 100644 --- a/src/window.c +++ b/src/window.c @@ -156,8 +156,18 @@ get_child_info (Window w) PRINT_DEBUG(("pid: %d\n", pid)); - /* The pids will hopefully be in the same session. */ + /* + The pids will hopefully be in the same session. + + XXX what's the use of this session check? + On some platforms (eg. OpenBSD) you get EPERM if `pid' is not in the + same session as ratpoison. This makes stuff like %p in winformat much + less useful... + */ sid = getsid (pid); + if (sid == -1) + return NULL; + list_for_each_entry (cur, &rp_children, node) { PRINT_DEBUG(("cur->pid=%d sid=%d\n", cur->pid, getsid (cur->pid))); |