Skip to content

Commit 080fce7

Browse files
committed
cli: Reset executable name
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]>
1 parent cc6ddc3 commit 080fce7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/src/cli.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! Command line tool to manage bootable ostree-based containers.
44
5+
use std::ffi::CString;
56
use std::ffi::OsString;
67
use std::io::Seek;
78
use std::os::unix::process::CommandExt;
@@ -796,6 +797,13 @@ async fn usroverlay() -> Result<()> {
796797
/// Perform process global initialization. This should be called as early as possible
797798
/// in the standard `main` function.
798799
pub fn global_init() -> Result<()> {
800+
// In some cases we re-exec with a temporary binary,
801+
// so ensure that the syslog identifier is set.
802+
ostree::glib::set_prgname("bootc".into());
803+
if let Err(e) = rustix::thread::set_name(&CString::new("bootc").unwrap()) {
804+
// This shouldn't ever happen
805+
eprintln!("failed to set name: {e}");
806+
}
799807
let am_root = rustix::process::getuid().is_root();
800808
// Work around bootc-image-builder not setting HOME, in combination with podman (really c/common)
801809
// bombing out if it is unset.

0 commit comments

Comments
 (0)