Branch: Tag:

2016-03-21

2016-03-21 10:01:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Filesystem: Open files in the same way for all requests.

Use Stdio.File()->open() to open files and NOT roxenloader::open().

Fixes some path confusion issues.

1138:    }    }    -  object to = open(f, "wct"); -  int err = errno(); +  object to = Stdio.File();       TRACE_ENTER("PUT: Accepted", 0);   
1148:    cache_set("stat_cache", f, 0);    }    -  if(!to) +  if(!to->open(f, "wct", 0666))    { -  +  int err = to->errno();    privs = 0;    TRACE_LEAVE("PUT: Open failed");    return errno_to_status (err, 1, id);
1735:    TRACE_LEAVE("PUT: Out of quota.");    return Roxen.http_status(507, "Out of disk quota.");    } -  object source_file = open(source_path, "r"); -  if (!source_file) { +  object source_file = Stdio.File(); +  if (!source_file->open(source_path, "r")) {    TRACE_LEAVE("Failed to open source file.");    return Roxen.http_status(404);    }
1746:    }    object privs;    SETUID_TRACE("COPY: Copying file.", 0); -  object dest_file = open(dest_path, "cwt"); +  object dest_file = Stdio.File(); +  if (!dest_file->open(dest_path, "cwt")) {    privs = 0; -  if (!dest_file) { +     return errno_to_status (errno(), 1, id);    } -  +  privs = 0;    int len = source_st->size;    while (len > 0) {    string buf = source_file->read((len > 4096)?4096:len);