diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 3002394a90c384d4575c5db6587884ccd64e3c6d..1b947931da1ad83fb3398f19ff59793c7e8c495e 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -6,7 +6,7 @@
 #define READ_BUFFER 8192
 
 #include "global.h"
-RCSID("$Id: file.c,v 1.44 1997/06/24 19:26:15 nisse Exp $");
+RCSID("$Id: file.c,v 1.45 1997/06/25 01:22:59 nisse Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "stralloc.h"
@@ -547,6 +547,7 @@ static void file_close(INT32 args)
 static void file_open(INT32 args)
 {
   int flags,fd;
+  int access;
   struct pike_string *str;
   do_close(FD, FILE_READ | FILE_WRITE);
   FD=-1;
@@ -560,6 +561,14 @@ static void file_open(INT32 args)
   if(sp[1-args].type != T_STRING)
     error("Bad argument 2 to file->open()\n");
 
+  if (args > 2)
+  {
+    if (sp[2-args].type != T_INT)
+      error("Bad argument 3 to file->open()\n");
+    access = sp[2-args].u.integer;
+  } else
+    access = 00666;
+      
   str=sp[-args].u.string;
   
   flags=parse(sp[1-args].u.string->str);
@@ -569,7 +578,7 @@ static void file_open(INT32 args)
 
   THREADS_ALLOW();
   do {
-    fd=open(str->str,map(flags), 00666);
+    fd=open(str->str,map(flags), access);
   } while(fd < 0 && errno == EINTR);
   THREADS_DISALLOW();