Skip to content

Commit

Permalink
cli: Reset executable name
Browse files Browse the repository at this point in the history
In some cases we re-exec ourselves; seeing the temporary file
in there is super ugly. In general ideally in the future
we support reliably querying journal logs from bootc; at least
this improves things so that one can do
`journalctl _COMM=bootc`.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Oct 28, 2024
1 parent cc6ddc3 commit 93424d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! Command line tool to manage bootable ostree-based containers.
use std::ffi::CString;
use std::ffi::OsString;
use std::io::Seek;
use std::os::unix::process::CommandExt;
Expand Down Expand Up @@ -796,6 +797,14 @@ async fn usroverlay() -> Result<()> {
/// Perform process global initialization. This should be called as early as possible
/// in the standard `main` function.
pub fn global_init() -> Result<()> {
// In some cases we re-exec with a temporary binary,
// so ensure that the syslog identifier is set.
let name = "bootc";
ostree::glib::set_prgname(name.into());
if let Err(e) = rustix::thread::set_name(&CString::new(name).unwrap()) {
// This shouldn't ever happen
eprintln!("failed to set name: {e}");
}
let am_root = rustix::process::getuid().is_root();
// Work around bootc-image-builder not setting HOME, in combination with podman (really c/common)
// bombing out if it is unset.
Expand Down

0 comments on commit 93424d7

Please sign in to comment.