From 3dd93dc08a00cf1dfdaebd84d9156c4885f98208 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Fri, 28 Feb 2014 12:21:21 +0100 Subject: [PATCH] - extended last fix --- snapper/File.cc | 13 ++++++++----- testsuite-real/permissions3.cc | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/snapper/File.cc b/snapper/File.cc index 1874752e..d62754eb 100644 --- a/snapper/File.cc +++ b/snapper/File.cc @@ -514,13 +514,16 @@ namespace snapper } } - if (getPreToPostStatus() & PERMISSIONS) + if (getPreToPostStatus() & (OWNER | GROUP | PERMISSIONS)) { - if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_mode) != 0) + if (!S_ISLNK(fs.st_mode)) { - y2err("chmod failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << - errno << " (" << stringerror(errno) << ")"); - return false; + if (chmod(getAbsolutePath(LOC_SYSTEM).c_str(), fs.st_mode) != 0) + { + y2err("chmod failed path:" << getAbsolutePath(LOC_SYSTEM) << " errno:" << + errno << " (" << stringerror(errno) << ")"); + return false; + } } } } diff --git a/testsuite-real/permissions3.cc b/testsuite-real/permissions3.cc index 3be99ea4..52ced731 100644 --- a/testsuite-real/permissions3.cc +++ b/testsuite-real/permissions3.cc @@ -9,16 +9,22 @@ main() { setup(); - run_command("echo hello > setuid"); - run_command("chmod u+s setuid"); + run_command("echo hello > setuid1"); + run_command("chmod u+s,a+x setuid1"); + + run_command("touch setuid2"); + run_command("chmod u+s,a+x setuid2"); first_snapshot(); - run_command("echo world >> setuid"); + run_command("echo world >> setuid1"); + + run_command("chown :nobody setuid2"); + run_command("chmod u+s setuid2"); second_snapshot(); - check_undo_statistics(0, 1, 0); + check_undo_statistics(0, 2, 0); undo(); -- 2.47.3