copy: change the various copy_xyz() calls to take a unified flags parameter
This adds a unified "copy_flags" parameter to all copy_xyz() function calls, replacing the various boolean flags so far used. This should make many invocations more readable as it is clear what behaviour is precisely requested. This also prepares ground for adding support for more modes later on.
This commit is contained in:
+3
-3
@@ -1364,7 +1364,7 @@ static int setup_resolv_conf(const char *dest) {
|
||||
}
|
||||
|
||||
/* If that didn't work, let's copy the file */
|
||||
r = copy_file("/etc/resolv.conf", where, O_TRUNC|O_NOFOLLOW, 0644, 0);
|
||||
r = copy_file("/etc/resolv.conf", where, O_TRUNC|O_NOFOLLOW, 0644, 0, COPY_REFLINK);
|
||||
if (r < 0) {
|
||||
/* If the file already exists as symlink, let's suppress the warning, under the assumption that
|
||||
* resolved or something similar runs inside and the symlink points there.
|
||||
@@ -3700,7 +3700,7 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
r = copy_file(arg_image, np, O_EXCL, arg_read_only ? 0400 : 0600, FS_NOCOW_FL);
|
||||
r = copy_file(arg_image, np, O_EXCL, arg_read_only ? 0400 : 0600, FS_NOCOW_FL, COPY_REFLINK);
|
||||
if (r < 0) {
|
||||
r = log_error_errno(r, "Failed to copy image file: %m");
|
||||
goto finish;
|
||||
@@ -3856,7 +3856,7 @@ finish:
|
||||
|
||||
/* Try to flush whatever is still queued in the pty */
|
||||
if (master >= 0) {
|
||||
(void) copy_bytes(master, STDOUT_FILENO, (uint64_t) -1, false);
|
||||
(void) copy_bytes(master, STDOUT_FILENO, (uint64_t) -1, 0);
|
||||
master = safe_close(master);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user