commit b6b5be5ebba548dfc0c61cd54704980d2fc50916
parent a86198f1fad847ba8797373a4af1a6293819de11
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:
1 file changed, 2 insertions(+), 2 deletions(-)
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)