dosfstools/0003-Remove-long-file-name-when-changing-short-file-name.patch

54 lines
1.6 KiB
Diff
Raw Normal View History

2019-09-30 10:37:32 -04:00
From 4f953bb5d74e0eeda6cbee1e4871513edc7b912b Mon Sep 17 00:00:00 2001
From: Andreas Bombe <aeb@debian.org>
Date: Mon, 11 Jun 2018 14:21:17 +0200
Subject: [PATCH 68/86] Remove long file name when changing short file name
In the current state, long file names are poorly supported and in case
the file got automatically or manually renamed in auto_rename() or
rename_file(), only the short file name would be manipulated.
Only the checksum would be fixed to have the LFN stay valid. This would
cause issues such as the rename being hidden by the unchanged LFN or
duplicate LFNs remaining if they were the cause for a rename.
Change so that existing LFNs are removed for files being renamed.
---
src/check.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/check.c b/src/check.c
index 49dd427..76c9c3d 100644
--- a/src/check.c
+++ b/src/check.c
@@ -293,9 +293,10 @@ static void auto_rename(DOS_FILE * file)
} else {
fs_write(file->offset, MSDOS_NAME, file->dir_ent.name);
}
- if (file->lfn)
- lfn_fix_checksum(file->lfn_offset, file->offset,
- (const char *)file->dir_ent.name);
+ if (file->lfn) {
+ lfn_remove(file->lfn_offset, file->offset);
+ file->lfn = NULL;
+ }
return;
}
number++;
@@ -334,9 +335,10 @@ static void rename_file(DOS_FILE * file)
} else {
fs_write(file->offset, MSDOS_NAME, file->dir_ent.name);
}
- if (file->lfn)
- lfn_fix_checksum(file->lfn_offset, file->offset,
- (const char *)file->dir_ent.name);
+ if (file->lfn) {
+ lfn_remove(file->lfn_offset, file->offset);
+ file->lfn = NULL;
+ }
return;
}
}
--
1.8.3.1