From 4457b8ae37b9605b088b32f59d2b08ede6f553c8 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 14 Sep 2023 15:47:22 +0200 Subject: [PATCH] - fixed creating files in root dir (gh#openSUSE/snapper#168) --- LIBVERSION | 2 +- package/snapper.changes | 5 +++++ snapper/File.cc | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/LIBVERSION b/LIBVERSION index 21c8c7b4..a8a18875 100644 --- a/LIBVERSION +++ b/LIBVERSION @@ -1 +1 @@ -7.1.1 +7.1.2 diff --git a/package/snapper.changes b/package/snapper.changes index efa81bf8..f50e6679 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 14 15:45:53 CEST 2023 - aschnell@suse.com + +- fixed creating files in root dir (gh#openSUSE/snapper#168) + ------------------------------------------------------------------- Thu Aug 10 09:20:42 CEST 2023 - aschnell@suse.com diff --git a/snapper/File.cc b/snapper/File.cc index a1b3dbe3..8a91494f 100644 --- a/snapper/File.cc +++ b/snapper/File.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2015] Novell, Inc. - * Copyright (c) 2022 SUSE LLC + * Copyright (c) [2022-2023] SUSE LLC * * All Rights Reserved. * @@ -25,10 +25,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -279,7 +279,7 @@ namespace snapper File::createParentDirectories(const string& path) const { string::size_type pos = path.rfind('/'); - if (pos == string::npos) + if (pos == 0 || pos == string::npos) return true; const string& leading_path = path.substr(0, pos);