From 571c490125f41365b71114d3751e6b8a77cc1999 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Mon, 5 Dec 2022 08:12:50 +0100 Subject: [PATCH] - fixed constness of context_str return value --- package/snapper.changes | 5 +++++ snapper/FileUtils.cc | 6 +++--- snapper/FileUtils.h | 6 +++--- snapper/Selinux.cc | 2 +- snapper/Selinux.h | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/package/snapper.changes b/package/snapper.changes index 1300a8c7..05d93365 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 05 08:13:07 CET 2022 - aschnell@suse.com + +- fix build with never selinux + ------------------------------------------------------------------- Tue Nov 15 13:24:47 CET 2022 - aschnell@suse.com diff --git a/snapper/FileUtils.cc b/snapper/FileUtils.cc index 5add3d46..97c5f51f 100644 --- a/snapper/FileUtils.cc +++ b/snapper/FileUtils.cc @@ -621,7 +621,7 @@ namespace snapper bool - SDir::fsetfilecon(const string& name, char* con) const + SDir::fsetfilecon(const string& name, const char* con) const { assert(name.find('/') == string::npos); assert(name != ".."); @@ -724,7 +724,7 @@ namespace snapper bool - SDir::fsetfilecon(char* con) const + SDir::fsetfilecon(const char* con) const { bool retval = true; @@ -850,7 +850,7 @@ namespace snapper void - SFile::fsetfilecon(char* con) const + SFile::fsetfilecon(const char* con) const { dir.fsetfilecon(name, con); } diff --git a/snapper/FileUtils.h b/snapper/FileUtils.h index b0a35f7e..2b189d06 100644 --- a/snapper/FileUtils.h +++ b/snapper/FileUtils.h @@ -108,8 +108,8 @@ namespace snapper const string& mount_data) const; bool umount(const string& mount_point) const; - bool fsetfilecon(const string& name, char* con) const; - bool fsetfilecon(char* con) const; + bool fsetfilecon(const string& name, const char* con) const; + bool fsetfilecon(const char* con) const; bool restorecon(SelinuxLabelHandle* sh) const; bool restorecon(const string& name, SelinuxLabelHandle* sh) const; @@ -146,7 +146,7 @@ namespace snapper ssize_t listxattr(char* list, size_t size) const; ssize_t getxattr(const char* name, void* value, size_t size) const; - void fsetfilecon(char* con) const; + void fsetfilecon(const char* con) const; void restorecon(SelinuxLabelHandle* sh) const; private: diff --git a/snapper/Selinux.cc b/snapper/Selinux.cc index fefb2c62..e7fad523 100644 --- a/snapper/Selinux.cc +++ b/snapper/Selinux.cc @@ -82,7 +82,7 @@ namespace snapper } - DefaultSelinuxFileContext::DefaultSelinuxFileContext(char* context) + DefaultSelinuxFileContext::DefaultSelinuxFileContext(const char* context) { if (setfscreatecon(context) < 0) { diff --git a/snapper/Selinux.h b/snapper/Selinux.h index 2e5d806b..38735ced 100644 --- a/snapper/Selinux.h +++ b/snapper/Selinux.h @@ -50,7 +50,7 @@ namespace snapper class SnapperContexts { public: - char* subvolume_context() const { return context_str(subvolume_ctx); } + const char* subvolume_context() const { return context_str(subvolume_ctx); } SnapperContexts(); ~SnapperContexts() { context_free(subvolume_ctx); } @@ -61,7 +61,7 @@ namespace snapper class DefaultSelinuxFileContext : private boost::noncopyable { public: - DefaultSelinuxFileContext(char* context); + DefaultSelinuxFileContext(const char* context); ~DefaultSelinuxFileContext(); }; -- 2.47.3