From 4ee5b0ea12dd226c7187429214d0e6029390363f Mon Sep 17 00:00:00 2001 From: junan Date: Sun, 8 Sep 2024 09:50:35 +0800 Subject: [PATCH] AP_HAL_Linux: keep "dfd" open util fsync is done. Since we want to do a fsync on "dfd", it can not be closed before that. Signed-off-by: junan --- libraries/AP_HAL_Linux/Storage.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/AP_HAL_Linux/Storage.cpp b/libraries/AP_HAL_Linux/Storage.cpp index fe4641e082d11..7d3a460b62e75 100644 --- a/libraries/AP_HAL_Linux/Storage.cpp +++ b/libraries/AP_HAL_Linux/Storage.cpp @@ -104,8 +104,6 @@ int Storage::_storage_create(const char *dpath) unlinkat(dfd, dpath, 0); int fd = openat(dfd, STORAGE_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0666); - close(dfd); - if (fd == -1) { fprintf(stderr, "Failed to create storage file %s/%s\n", dpath, STORAGE_FILE);