X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_fdopen.c;h=c628ebcd1e5da4ebf48131e2b9771c47c4d0cce1;hb=eb6f9c3c6065ad3975d69630d622d91374784806;hp=85563270fa5029c7d4dbe73971c8bb273f375f30;hpb=219271fd548949abce8bd75c34dd42e519418fc4;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 */