X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_fdopen.c;h=c628ebcd1e5da4ebf48131e2b9771c47c4d0cce1;hb=84d648157e22cecc65902ecfdd4e3a1b88d5e53f;hp=85563270fa5029c7d4dbe73971c8bb273f375f30;hpb=217a2f477ad6dbbac816981589ee2f5a81dffd67;p=pdclib.old 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 */