aboutsummaryrefslogtreecommitdiffstats
path: root/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'core.c')
-rw-r--r--core.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/core.c b/core.c
index a152656..90f8fd9 100644
--- a/core.c
+++ b/core.c
@@ -121,7 +121,11 @@ int file_open_fn( file_t *ft, const char *filename, int flags )
ft->fd = fd;
ft->flags = flags;
- ft->filename = filename;
+
+ uint8_t fn_sz = strlen( filename );
+ char *fn = malloc( fn_sz );
+ memcpy( fn, filename, fn_sz );
+ ft->filename = fn;
/* set current file cursor postion and file size */
@@ -314,6 +318,15 @@ int file_s_mode( file_t *ft, int mode )
return ret;
}
+int file_s_bufs( file_t *ft, unsigned int size )
+{
+ int ret = 0;
+
+ ft->blk_size = size;
+
+ return ret;
+}
+
int file_close( file_t *ft )
{
@@ -322,13 +335,13 @@ int file_close( file_t *ft )
if ( ft->fd < 1 )
{
printf("File descriptor <1\n");
- ret = -1;
+ return -1;
}
if ( ft->filename == NULL )
{
printf("File name is empty\n");
- ret = -1;
+ return -1;
}
fd_close( ft->fd );