mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Add missing fs.c
This commit is contained in:
parent
f84f3da012
commit
02b3b780bb
21
src/fs.c
Normal file
21
src/fs.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "fs.h"
|
||||
|
||||
struct mg_fd *mg_fs_open(struct mg_fs *fs, const char *path, int flags) {
|
||||
struct mg_fd *fd = (struct mg_fd *) calloc(1, sizeof(*fd));
|
||||
if (fd != NULL) {
|
||||
fd->fd = fs->open(path, flags);
|
||||
fd->fs = fs;
|
||||
if (fd->fd == NULL) {
|
||||
free(fd);
|
||||
fd = NULL;
|
||||
}
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
void mg_fs_close(struct mg_fd *fd) {
|
||||
if (fd != NULL) {
|
||||
fd->fs->close(fd->fd);
|
||||
free(fd);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user