chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
machined,machinectl: add calls for changing container/VM quotas
[elogind.git]
/
src
/
shared
/
copy.c
diff --git
a/src/shared/copy.c
b/src/shared/copy.c
index 3df636704c3ba9a333bb440d00cc2948eec48e39..0239a58066ec3314dc004fde3a3a49cf84846e2b 100644
(file)
--- a/
src/shared/copy.c
+++ b/
src/shared/copy.c
@@
-359,7
+359,7
@@
int copy_file_fd(const char *from, int fdt, bool try_reflink) {
return r;
}
return r;
}
-int copy_file(const char *from, const char *to, int flags, mode_t mode) {
+int copy_file(const char *from, const char *to, int flags, mode_t mode
, unsigned chattr_flags
) {
int fdt, r;
assert(from);
int fdt, r;
assert(from);
@@
-371,6
+371,9
@@
int copy_file(const char *from, const char *to, int flags, mode_t mode) {
return -errno;
}
return -errno;
}
+ if (chattr_flags != 0)
+ (void) chattr_fd(fdt, true, chattr_flags);
+
r = copy_file_fd(from, fdt, true);
if (r < 0) {
close(fdt);
r = copy_file_fd(from, fdt, true);
if (r < 0) {
close(fdt);
@@
-386,7
+389,7
@@
int copy_file(const char *from, const char *to, int flags, mode_t mode) {
return 0;
}
return 0;
}
-int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace) {
+int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace
, unsigned chattr_flags
) {
_cleanup_free_ char *t;
int r;
_cleanup_free_ char *t;
int r;
@@
-397,7
+400,7
@@
int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace
if (r < 0)
return r;
if (r < 0)
return r;
- r = copy_file(from, t, O_NOFOLLOW|O_EXCL, mode);
+ r = copy_file(from, t, O_NOFOLLOW|O_EXCL, mode
, chattr_flags
);
if (r < 0)
return r;
if (r < 0)
return r;