Roxen.git / server / modules / filesystems / filesystem.pike

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1131:    mkdirhier(f);       if (id->misc->quota_obj) {    QUOTA_WERR("Checking if the file already existed.");    if (size > 0) {    QUOTA_WERR("Deallocating " + size + "bytes.");    id->misc->quota_obj->deallocate(URI, size);    }    }    -  object to = open(f, "wct"); -  int err = errno(); +  object to = Stdio.File();       TRACE_ENTER("PUT: Accepted", 0);       /* Clear the stat-cache for this file */    if (stat_cache) {    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);    }       // FIXME: Race-condition.    string msg = safe_chmod(f, 0666 & ~(id->misc->umask || 022));    privs = 0;       putting[id->my_fd] = id->misc->len;
Roxen.git/server/modules/filesystems/filesystem.pike:1728:    QUOTA_WERR("Checking quota.\n");    if (id->misc->quota_obj && (id->misc->len > 0) &&    !id->misc->quota_obj->check_quota(mountpoint + dest,    source_st->size)) {    errors++;    report_warning(LOCALE(47,"Creation of %O failed. Out of quota.\n"),    dest_path);    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);    }    // Workaround for Linux, Tru64 and FreeBSD.    if (has_suffix(dest_path, "/")) {    dest_path = dest_path[..sizeof(dest_path)-2];    }    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);    if (buf && sizeof(buf)) {    int sub_len;    len -= (sub_len = sizeof(buf));    while (sub_len > 0) {    int written = dest_file->write(buf);    if ((sub_len -= written) > 0) {    if (!written) {