mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 02:08:08 +08:00
Change ff_open to explicit memcpy()
This commit is contained in:
parent
f40b272eeb
commit
46af09f776
@ -986,7 +986,7 @@ static void *ff_open(const char *path, int flags) {
|
|||||||
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
|
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
|
||||||
if (f_open(&f, path, mode) == 0) {
|
if (f_open(&f, path, mode) == 0) {
|
||||||
FIL *fp = calloc(1, sizeof(*fp));
|
FIL *fp = calloc(1, sizeof(*fp));
|
||||||
*fp = f;
|
memcpy(fp, &f, sizeof(*fp));
|
||||||
return fp;
|
return fp;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -74,7 +74,7 @@ static void *ff_open(const char *path, int flags) {
|
|||||||
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
|
if (flags & MG_FS_WRITE) mode |= FA_WRITE | FA_OPEN_ALWAYS | FA_OPEN_APPEND;
|
||||||
if (f_open(&f, path, mode) == 0) {
|
if (f_open(&f, path, mode) == 0) {
|
||||||
FIL *fp = calloc(1, sizeof(*fp));
|
FIL *fp = calloc(1, sizeof(*fp));
|
||||||
*fp = f;
|
memcpy(fp, &f, sizeof(*fp));
|
||||||
return fp;
|
return fp;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user