Fix logic error in Tramp, setting file ownership

* lisp/net/tramp.el (tramp-skeleton-write-region): Fix logic in
changing file ownership.  (Bug#56180)

Copyright-paperwork-exempt: yes
10 jobs for master in 17 minutes and 9 seconds (queued for 5 seconds)
Status Job ID Name Coverage
  Build Images
failed #48155
build-image-inotify

00:14:08

 
  Normal
skipped #48156
test-all-inotify
 
  Platform Images
failed #48157
build-image-filenotify-gio

00:15:50

failed #48158
build-image-gnustep

00:15:04

 
  Platforms
skipped #48159
test-filenotify-gio
skipped #48160
test-gnustep
 
  Native Comp Images
failed #48161
build-native-comp-speed0

00:16:15

failed #48162
build-native-comp-speed1

00:17:06

failed #48163
build-native-comp-speed2

00:15:02

 
  Native Comp
skipped #48164
test-native-comp-speed0
 
Name Stage Failure
failed
build-native-comp-speed1 Native Comp Images
executor failed running [/bin/sh -c make bootstrap -j2 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 1)"']: exit code: 2
Running after_script
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-native-comp-speed1-de0b7af1: No such file or directory
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1

failed
build-native-comp-speed0 Native Comp Images
 > [emacs-native-comp-speed0 4/4] RUN make bootstrap -j2       NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"':
------
executor failed running [/bin/sh -c make bootstrap -j2 NATIVE_FULL_AOT=1 BYTE_COMPILE_EXTRA_FLAGS='--eval "(setq comp-speed 0)"']: exit code: 2
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-native-comp-speed0-de0b7af1: No such file or directory
ERROR: Job failed: exit code 1
failed
build-image-filenotify-gio Platform Images
executor failed running [/bin/sh -c make bootstrap]: exit code: 2
Running after_script
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-image-filenotify-gio-de0b7af1: No such file or directory
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1

failed
build-native-comp-speed2 Native Comp Images
------
executor failed running [/bin/sh -c make bootstrap -j2]: exit code: 2
Running after_script
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-native-comp-speed2-de0b7af1: No such file or directory
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
build-image-gnustep Platform Images
------
executor failed running [/bin/sh -c make bootstrap]: exit code: 2
Running after_script
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-image-gnustep-de0b7af1: No such file or directory
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
build-image-inotify Build Images
------
executor failed running [/bin/sh -c make bootstrap]: exit code: 2
Running after_script
Running after script...
$ test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name}
$ test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name}
$ find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete
find: build-image-inotify-de0b7af1: No such file or directory
Cleaning up file based variables
ERROR: Job failed: exit code 1