pike.git / src / modules / _Stdio / file.c

version» Context lines:

pike.git/src/modules/_Stdio/file.c:2923:    * (grubba 2004-09-01    */    init_fd(fd, flags | low_fd_query_properties(fd), FILE_NOT_OPENED);    }       pop_n_elems(args);    push_int(fd>=0);   }      #ifdef HAVE_OPENAT - /*! @decl Stdio.File openat(string filename, string mode) + /*! @decl Stdio.File openat(string filename) +  *! @decl Stdio.File openat(string filename, string mode)    *! @decl Stdio.File openat(string filename, string mode, int access)    *!    *! Open a file relative to an opened directory.    *!    *! @returns    *! Returns a new file object on success, and @expr{0@} (zero) on failure.    *!    *! @note    *! Not available on all architectures.    *!    *! @seealso    *! @[open()], @[statat()], @[unlinkat()]    */   static void file_openat(INT32 args)   {    int flags, fd, dir_fd; -  int access = 00666; +  int access = 0777;    int err; -  struct pike_string *str, *flag_str; +  struct pike_string *str, *flag_str = 0;       if((dir_fd = FD) < 0)    Pike_error("File not open.\n");    -  get_all_args(NULL, args, "%S%S.%d", &str, &flag_str, &access); +  get_all_args(NULL, args, "%S.%S%d", &str, &flag_str, &access);    -  flags = parse(flag_str->str); +  flags = flag_str ? parse(flag_str->str) : FILE_READ;       if (string_has_null(str)) {    /* Filenames with NUL are not supported. */    ERRNO = errno = ENOENT;    pop_n_elems(args);    push_int(0);    return;    }       if(!(flags & (FILE_READ | FILE_WRITE)))