OpenBSD: fix unveil(2) - ii - irc it, simple FIFO based irc client
(HTM) git clone git://git.suckless.org/ii
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b6b5be5ebba548dfc0c61cd54704980d2fc50916
(DIR) parent a86198f1fad847ba8797373a4af1a6293819de11
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 20 Nov 2025 16:34:13 +0100
OpenBSD: fix unveil(2)
The directory must exist before unveil.
Check the return status (it was used for testing).
Diffstat:
M ii.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/ii.c b/ii.c
@@ -907,14 +907,14 @@ main(int argc, char *argv[])
r = snprintf(ircpath, sizeof(ircpath), "%s/%s", prefix, host);
if (r < 0 || (size_t)r >= sizeof(ircpath))
die("%s: path to irc directory too long\n", argv0);
+ create_dirtree(ircpath);
#ifdef __OpenBSD__
- if (unveil(ircpath, "rwc") == 0)
+ if (unveil(ircpath, "rwc") == -1)
die("%s: unveil: %s: %s\n", argv0, ircpath, strerror(errno));
if (pledge("stdio rpath wpath cpath dpath", NULL) == -1)
die("%s: pledge: %s\n", argv0, strerror(errno));
#endif
- create_dirtree(ircpath);
channelmaster = channel_add(""); /* master channel */
if (key)