fs: use a static variable in calls to BFile_Create()

There is no evidence that BFile_Create() keeps the address and writes
to it later on, but I'd rather be overly careful than have to debug a
stack corruption problem in half a year :)
This commit is contained in:
Lephe 2022-01-10 13:38:28 +01:00
parent 59a3b39fb4
commit 8aea762e7a
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@
#include "util.h"
#include "fugue.h"
/* TODO: fugue_open(): Handle trailing '/' and filesystem root */
static int new_file_size;
int fugue_open(char const *path, int flags, GUNUSED mode_t mode)
{
@ -91,8 +91,8 @@ int fugue_open(char const *path, int flags, GUNUSED mode_t mode)
/* If the file does not exist and O_CREAT is set, create it */
if((flags & O_CREAT) && ((flags & O_TRUNC) || fugue_fd < 0)) {
int size = 0;
err = BFile_Create(fcpath, BFile_File, &size);
new_file_size = 0;
err = BFile_Create(fcpath, BFile_File, &new_file_size);
if(err < 0) {
errno = bfile_error_to_errno(err);
rc = -1;