Skip to content

Commit

Permalink
Merge pull request #849 from cgwalters/syslog-identifier
Browse files Browse the repository at this point in the history
cli: Reset executable name
  • Loading branch information
cgwalters authored Oct 28, 2024
2 parents cc6ddc3 + 93424d7 commit ba82772
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 ba82772

Please sign in to comment.