Skip to content

Commit

Permalink
added support for fdopen
Browse files Browse the repository at this point in the history
  • Loading branch information
l3utterfly committed Nov 10, 2024
1 parent f956aab commit 5d9a182
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,16 @@ FILE * ggml_fopen(const char * fname, const char * mode) {

return file;
#else
// if file does not have a path, we assume it's a file descriptor
if (strchr(fname, '/') == NULL) {
char *endptr;
long num = strtol(fname, &endptr, 10);
FILE *file = fdopen(dup(num), mode);

if (file != NULL) {
return file;
}
}
return fopen(fname, mode);
#endif

Expand Down

0 comments on commit 5d9a182

Please sign in to comment.