Repositories / jai.git

jai.git

Clone (read-only): git clone http://git.guha-anderson.com/git/jai.git

Branch

don't throw in setns, because used in destructors

Author
David Mazieres <dm@uun.org>
Date
2026-03-15 12:42:21 -0700
Commit
467349b546c1e499d618fb1a17ad025360e58063
jai.cc
index 25982a4..367d31f 100644
--- a/jai.cc
+++ b/jai.cc
@@ -762,7 +762,7 @@ Config::opt_parser()
       "Use private or overlay home directory NAME", "NAME");
   opts("--conf", [this, opts = ret.get()](path file) {
     if (!parse_config_file(file, opts))
-      warn("{}: configuration file not found", file.string());
+      err<Options::Error>("{}: configuration file not found", file.string());
   });
   opts(
       "--strict", [this] { mode_ = kStrict; },
@@ -821,8 +821,8 @@ do_main(int argc, char **argv)
   // Override inline conf to make CLI idempotent
   (*opts)(
       "-C", "--conf", [&](path p) { opt_C = p; },
-      R"(Use FILE as configuration file (relative to ~/.jai).
-Default: CMD.conf or default.conf if CMD.conf does not exist)",
+      R"(Use FILE as configuration file (relative to ~/.jai)
+default: CMD.conf or default.conf if CMD.conf does not exist)",
       "FILE");
   (*opts)("--help", [] { usage(1); });
   (*opts)("--version", version, "Print copyright and version then exit");
@@ -871,9 +871,6 @@ main(int argc, char **argv)
   else
     prog = PACKAGE_TARNAME;
 
-  // do_main(argc, argv);
-  // return 0;
-
   try {
     do_main(argc, argv);
   } catch (const std::exception &e) {
jai.h
index 11cb808..82ec24a 100644
--- a/jai.h
+++ b/jai.h
@@ -22,7 +22,7 @@ xfork(std::uint64_t flags = 0)
 #define xsetns(fd, type)                                                       \
   do {                                                                         \
     if (setns(fd, type)) {                                                     \
-      syserr("setns({}, {})", fdpath(fd), #type);                              \
+      warn("setns({}, {}): {}", fdpath(fd), #type, strerror(errno));           \
       exit(1);                                                                 \
     }                                                                          \
   } while (0)