TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  7.26.1.aChecked automatically with code checker

Synopsis:Don't use the functions readdir instead use the re-entrant counterpart readdir_r
Language:C
Severity Level:5
Category:Library


Description:

Justification

Non-reentrant functions can cause problems when multiple threads are used or memory is shared between tasks (such as on VxWorks).

Example

#include <sys/types.h>
#include <dirent.h>

struct dirent *readdir(DIR *dirp); /* WRONG */
struct dirent *readdir_r(DIR *dirp, struct dirent *entry); /* RIGHT */