TFTP
Fix critical error in open implementation
This commit is contained in:
@@ -34,13 +34,12 @@ void* tftp_open(const char* fname, const char* mode, u8_t write) {
|
||||
llfs_file_t* file;
|
||||
|
||||
if (strcmp(fname, virt_file[0].name) == 0 && write == TFTP_READ) {
|
||||
file = &virt_file[0];
|
||||
return &virt_file[0];
|
||||
} else if (strcmp(fname, virt_file[1].name) == 0 && write != TFTP_READ) {
|
||||
file = &virt_file[1];
|
||||
return &virt_file[1];
|
||||
}
|
||||
|
||||
file = llfs_file_open(fname);
|
||||
return file;
|
||||
return llfs_file_open(fname);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +53,8 @@ void tftp_close(void* handle) {
|
||||
|
||||
/**
|
||||
* @brief This function is called when a file is read
|
||||
* The virtual files are filtered out first
|
||||
* then the file is trying to get read from the llfs
|
||||
*
|
||||
* @param handle File handle returned by open()
|
||||
* @param buf Target buffer to copy read data to
|
||||
|
||||
Reference in New Issue
Block a user