fs: refactor handleTimestampsAndMode to remove redundant call

Refactored the `handleTimestampsAndMode` function to eliminate the
redundant `setDestTimestampsAndMode` call. This simplifies the function
by ensuring that `setDestTimestampsAndMode` is only called once after
any necessary modifications to file writability.

PR-URL: https://github.com/nodejs/node/pull/54369
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
HEESEUNG authored and RafaelGSS committed 2024-08-30 15:52:12 -03:00
1 parent 467ac3aec4
commit fc08a9b0cd
1 file changed
-1
-1
View File
@@ -270,7 +270,6 @@ async function handleTimestampsAndMode(srcMode, src, dest) {
// (through utimes call)
if (fileIsNotWritable(srcMode)) {
await makeFileWritable(dest, srcMode);
return setDestTimestampsAndMode(srcMode, src, dest);
}
return setDestTimestampsAndMode(srcMode, src, dest);
}