|
6 | 6 | #include <cf3.defs.h>
|
7 | 7 | #include <string_lib.h>
|
8 | 8 | #include <file_lib.h>
|
| 9 | +#include <fsattrs.h> |
9 | 10 |
|
10 | 11 | bool OverrideImmutableBegin(
|
11 | 12 | const char *orig, char *copy, size_t copy_len, bool override)
|
@@ -70,15 +71,17 @@ bool OverrideImmutableCommit(
|
70 | 71 | struct stat sb;
|
71 | 72 | if (lstat(orig, &sb) == -1)
|
72 | 73 | {
|
73 |
| - Log(LOG_LEVEL_ERR, "Failed to stat file '%s'", orig); |
| 74 | + Log(LOG_LEVEL_ERR, |
| 75 | + "Failed to stat file '%s' during immutable operations", |
| 76 | + orig); |
74 | 77 | unlink(copy);
|
75 | 78 | return false;
|
76 | 79 | }
|
77 | 80 |
|
78 | 81 | if (chmod(copy, sb.st_mode) == -1)
|
79 | 82 | {
|
80 | 83 | Log(LOG_LEVEL_ERR,
|
81 |
| - "Failed to change mode bits on file '%s' to %04jo: %s", |
| 84 | + "Failed to change mode bits on file '%s' to %04jo during immutable operations: %s", |
82 | 85 | orig,
|
83 | 86 | (uintmax_t) sb.st_mode,
|
84 | 87 | GetErrorStr());
|
@@ -111,11 +114,20 @@ FSAttrsResult TemporarilyClearImmutableBit(
|
111 | 114 | }
|
112 | 115 | else
|
113 | 116 | {
|
114 |
| - Log((res == FS_ATTRS_FAILURE) ? LOG_LEVEL_ERR |
115 |
| - : LOG_LEVEL_VERBOSE, |
116 |
| - "Failed to temporarily clear immutable bit for file '%s': %s", |
117 |
| - filename, |
118 |
| - FSAttrsErrorCodeToString(res)); |
| 117 | + if (res == FS_ATTRS_FAILURE) |
| 118 | + { |
| 119 | + Log(LOG_LEVEL_ERR, |
| 120 | + "Failed to temporarily clear immutable bit for file '%s': %s", |
| 121 | + filename, |
| 122 | + FSAttrsErrorCodeToString(res)); |
| 123 | + } |
| 124 | + else |
| 125 | + { |
| 126 | + Log(LOG_LEVEL_VERBOSE, |
| 127 | + "Could not temporarily clear immutable bit for file '%s': %s", |
| 128 | + filename, |
| 129 | + FSAttrsErrorCodeToString(res)); |
| 130 | + } |
119 | 131 | }
|
120 | 132 | }
|
121 | 133 | else
|
|
0 commit comments