[PR #238] [MERGED] Write to temp file before saving data #2639

Closed
opened 2025-11-20 07:12:03 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/238
Author: @mlsmaycon
Created: 2/20/2022
Status: Merged
Merged: 2/20/2022
Merged by: @mlsmaycon

Base: mainHead: create-new-file-on-writing


📝 Commits (3)

  • b9463c1 Create temp file before saving data
  • cce0f49 Close the tempFile instance before moving it
  • cf6b70b Blacklist Wireguard interfaces for ICE checks

📊 Changes

3 files changed (+40 additions, -8 deletions)

View changed files

📝 client/internal/peer/conn.go (+14 -4)
📝 go.sum (+0 -2)
📝 util/file.go (+26 -2)

📄 Description

In the event of a full disk, we may encounter the case where the destination file gets replaced by an empty file as the ioutil.WriteFile truncates the destination before writing.

Closes #237


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/238 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 2/20/2022 **Status:** ✅ Merged **Merged:** 2/20/2022 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `create-new-file-on-writing` --- ### 📝 Commits (3) - [`b9463c1`](https://github.com/netbirdio/netbird/commit/b9463c1c4310d2dbc959c93dec0b9318ba4bf6df) Create temp file before saving data - [`cce0f49`](https://github.com/netbirdio/netbird/commit/cce0f4917f571d335d0027385acde02b19e7d4fb) Close the tempFile instance before moving it - [`cf6b70b`](https://github.com/netbirdio/netbird/commit/cf6b70b9da9165645728677f1255a08e3e937976) Blacklist Wireguard interfaces for ICE checks ### 📊 Changes **3 files changed** (+40 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/peer/conn.go` (+14 -4) 📝 `go.sum` (+0 -2) 📝 `util/file.go` (+26 -2) </details> ### 📄 Description In the event of a full disk, we may encounter the case where the destination file gets replaced by an empty file as the ioutil.WriteFile truncates the destination before writing. Closes #237 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 07:12:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2639