Skip to content

Commit

Permalink
- fixed creating files in root dir (gh##168)
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Sep 14, 2023
1 parent b3d7b19 commit 4457b8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LIBVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
7.1.2
5 changes: 5 additions & 0 deletions package/snapper.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Sep 14 15:45:53 CEST 2023 - [email protected]

- fixed creating files in root dir (gh#openSUSE/snapper#168)

-------------------------------------------------------------------
Thu Aug 10 09:20:42 CEST 2023 - [email protected]

Expand Down
8 changes: 4 additions & 4 deletions snapper/File.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) [2011-2015] Novell, Inc.
* Copyright (c) 2022 SUSE LLC
* Copyright (c) [2022-2023] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -25,10 +25,10 @@

#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <cstring>
#include <unistd.h>
#include <fnmatch.h>
#include <errno.h>
#include <cerrno>
#include <fcntl.h>
#include <locale>
#include <boost/algorithm/string.hpp>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4457b8a

Please sign in to comment.