fileop: Prevent poweroff during move

When overwriting an existing directory, the idle
power off timer may fire during the mass-renaming
of individual files.

Change-Id: Iedbc882c2470c32129a162d31dab8e5031a929b9
This commit is contained in:
Christian Soffke 2024-08-05 21:38:24 +02:00
parent ce417b3e1b
commit 512f5561ba

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include "string-extra.h" #include "string-extra.h"
#include "debug.h" #include "debug.h"
#include "powermgmt.h"
#include "misc.h" #include "misc.h"
#include "plugin.h" #include "plugin.h"
@ -259,6 +260,7 @@ static int move_by_rename(struct file_op_params *src,
{ {
unsigned int flags = *pflags; unsigned int flags = *pflags;
int rc = FORC_UNKNOWN_FAILURE; int rc = FORC_UNKNOWN_FAILURE;
reset_poweroff_timer();
if (!(flags & (PASTE_COPY | PASTE_EXDEV))) { if (!(flags & (PASTE_COPY | PASTE_EXDEV))) {
if ((flags & PASTE_OVERWRITE) || !file_exists(dst_path)) { if ((flags & PASTE_OVERWRITE) || !file_exists(dst_path)) {
/* Just try to move the directory / file */ /* Just try to move the directory / file */