static int truncufiles(const char *db) { if (truncfile(db, AFFTUPOST) < 0) return -1; if (truncfile(db, AFFTUFIELD) < 0) return -1; if (truncfile(db, AFFTUFIELD) < 0) return -1; return 0; }
static void ropen(Req *r) { Xfile *f; chat("open(fid=%d,mode=%d)...", thdr.fid, thdr.mode); errno = 0; f = xfile(r->fid, Asis); if( !f ){ errno = Eio; goto error; } if(thdr.mode & OTRUNC){ if( !S_ISREG(getmode(f)) ){ errno = Eperm; goto error; } if(truncfile(f) < 0){ goto error; } } chat("f->qid=0x%8.8lux...", r->fid->qid.path); rhdr.qid = r->fid->qid; error: response(r); }