MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / free_file_descriptor

Function free_file_descriptor

libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp:118–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118static int free_file_descriptor(int fileno)
119{
120 FAT_FILE *stream;
121 FIL *fh;
122
123 if (isatty_( fileno )) {
124 errno = EBADF;
125 return -1;
126 }
127
128 // checks if fileno out of bounds
129 stream = fileno_to_stream(fileno);
130 if (stream == nullptr) {
131 return -1;
132 }
133
134 fh = stream->fh;
135
136 if (fh != NULL) {
137 free(fh);
138 }
139
140 free(stream->name);
141 stream->name = NULL;
142
143 file_table[fileno] = NULL;
144 free(stream);
145 return fileno;
146}
147
148static FIL *fileno_to_fatfs(int fileno)
149{

Callers 2

openMethod · 0.85
closeMethod · 0.85

Calls 3

isatty_Function · 0.85
fileno_to_streamFunction · 0.85
freeFunction · 0.85

Tested by

no test coverage detected