(__getdate_r): Add extra access check.

This commit is contained in:
Ulrich Drepper 2000-09-01 02:28:03 +00:00
parent 294eccacf8
commit 407d349509

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#define TM_YEAR_BASE 1900 #define TM_YEAR_BASE 1900
@ -123,6 +124,9 @@ __getdate_r (const char *string, struct tm *tp)
if (!S_ISREG (st.st_mode)) if (!S_ISREG (st.st_mode))
return 4; return 4;
if (__access (datemsk, R_OK) < 0)
return 2;
/* Open the template file. */ /* Open the template file. */
fp = fopen (datemsk, "r"); fp = fopen (datemsk, "r");
if (fp == NULL) if (fp == NULL)