From 98564c2573ad4c540527c7172c11541065a3c848 Mon Sep 17 00:00:00 2001 From: silverpill Date: Wed, 7 Sep 2022 16:45:12 +0000 Subject: [PATCH] Improve panic message in case of storage directory UID mismatch --- src/config/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/main.rs b/src/config/main.rs index 5ec7a8f..4b1d66d 100644 --- a/src/config/main.rs +++ b/src/config/main.rs @@ -207,9 +207,15 @@ extern "C" { fn check_directory_owner(path: &Path) -> () { let metadata = std::fs::metadata(path) .expect("can't read file metadata"); + let owner_uid = metadata.uid(); let current_uid = unsafe { geteuid() }; - if metadata.uid() != current_uid { - panic!("directory owner is not the current user"); + if owner_uid != current_uid { + panic!( + "{} owner ({}) is different from the current user ({})", + path.display(), + owner_uid, + current_uid, + ); }; }