X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_fdopen.c;h=c628ebcd1e5da4ebf48131e2b9771c47c4d0cce1;hb=6ca24b75c75b9c6f22e1e69693d326b8e3330841;hp=85563270fa5029c7d4dbe73971c8bb273f375f30;hpb=5fd032eae66fba700cb9927840222b068c62361e;p=pdclib diff --git a/functions/stdio/_PDCLIB_fdopen.c b/functions/stdio/_PDCLIB_fdopen.c index 8556327..c628ebc 100644 --- a/functions/stdio/_PDCLIB_fdopen.c +++ b/functions/stdio/_PDCLIB_fdopen.c @@ -12,6 +12,7 @@ #ifndef REGTEST #include <_PDCLIB_glue.h> #include +#include extern struct _PDCLIB_file_t * _PDCLIB_filelist; @@ -39,6 +40,12 @@ struct _PDCLIB_file_t * _PDCLIB_fdopen( _PDCLIB_fd_t fd, /* no memory */ return NULL; } + + if(mtx_init(&rc->lock, mtx_recursive) != thrd_success) { + free(rc); + return NULL; + } + rc->status = mode; rc->handle = fd; /* Setting pointers into the memory block allocated above */