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
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -6,7 +6,7 @@
#include "util.h" #include "util.h"
#include "fugue.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) 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 the file does not exist and O_CREAT is set, create it */
if((flags & O_CREAT) && ((flags & O_TRUNC) || fugue_fd < 0)) { if((flags & O_CREAT) && ((flags & O_TRUNC) || fugue_fd < 0)) {
int size = 0; new_file_size = 0;
err = BFile_Create(fcpath, BFile_File, &size); err = BFile_Create(fcpath, BFile_File, &new_file_size);
if(err < 0) { if(err < 0) {
errno = bfile_error_to_errno(err); errno = bfile_error_to_errno(err);
rc = -1; rc = -1;