about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-01 02:28:03 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-01 02:28:03 +0000
commit407d349509f5e082ea1411cd3817579ce8968941 (patch)
tree6f5b0352657d947ef17792ebe9bb074286cb113f
parent294eccacf84ac20b2ce859b680ddcdf8255769ec (diff)
downloadglibc-407d349509f5e082ea1411cd3817579ce8968941.tar.gz
glibc-407d349509f5e082ea1411cd3817579ce8968941.tar.xz
glibc-407d349509f5e082ea1411cd3817579ce8968941.zip
(__getdate_r): Add extra access check.
-rw-r--r--time/getdate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/time/getdate.c b/time/getdate.c
index 626fb49d7a..99ee31cb2e 100644
--- a/time/getdate.c
+++ b/time/getdate.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <unistd.h>
 #include <sys/stat.h>
 
 #define TM_YEAR_BASE 1900
@@ -123,6 +124,9 @@ __getdate_r (const char *string, struct tm *tp)
   if (!S_ISREG (st.st_mode))
     return 4;
 
+  if (__access (datemsk, R_OK) < 0)
+    return 2;
+
   /* Open the template file.  */
   fp = fopen (datemsk, "r");
   if (fp == NULL)