[hackers] [ii] OpenBSD: fix unveil(2) || Hiltjo Posthuma
commit b6b5be5ebba548dfc0c61cd54704980d2fc50916
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Thu Nov 20 16:34:13 2025 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Thu Nov 20 16:34:13 2025 +0100
OpenBSD: fix unveil(2)
The directory must exist before unveil.
Check the return status (it was used for testing).
diff --git a/ii.c b/ii.c
index 63dc7d7..98c7c09 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -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)
Received on Thu Nov 20 2025 - 16:35:55 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 20 2025 - 16:36:50 CET