aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-17 13:47:32 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-06-17 13:49:39 -0700
commit3e20402491f013710dfa1c2f3d0cd6ab0e212585 (patch)
treed365092fed7590e4a624ca962039485b859ae9eb
parent1a37f0144d0fd777771c6d870e3c3298947e2712 (diff)
Fix corrupt file info forks
This fixes a bug that happens when: 1. Optional "Enable Resource Forks" feature is true 2. A file comment is added 3. The comment is updated to be shorter than the original The expected behavior is that the hidden .info file is replaced with the new data, but this wasn't happening because the file flag was not set to truncate on write.
-rw-r--r--hotline/file_wrapper.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go
index a26c45a..997325a 100644
--- a/hotline/file_wrapper.go
+++ b/hotline/file_wrapper.go
@@ -114,7 +114,7 @@ func (f *fileWrapper) rsrcForkWriter() (io.WriteCloser, error) {
}
func (f *fileWrapper) infoForkWriter() (io.WriteCloser, error) {
- file, err := os.OpenFile(f.infoPath, os.O_CREATE|os.O_WRONLY, 0644)
+ file, err := os.OpenFile(f.infoPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
if err != nil {
return nil, err
}