Skip to content

Commit ba82772

Browse files
authored
Merge pull request #849 from cgwalters/syslog-identifier
cli: Reset executable name
2 parents cc6ddc3 + 93424d7 commit ba82772

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/src/cli.rs

+9
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,14 @@ 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+
let name = "bootc";
803+
ostree::glib::set_prgname(name.into());
804+
if let Err(e) = rustix::thread::set_name(&CString::new(name).unwrap()) {
805+
// This shouldn't ever happen
806+
eprintln!("failed to set name: {e}");
807+
}
799808
let am_root = rustix::process::getuid().is_root();
800809
// Work around bootc-image-builder not setting HOME, in combination with podman (really c/common)
801810
// bombing out if it is unset.

0 commit comments

Comments
 (0)