Annotation of src/bin/cp/utils.c, revision 1.45.2.3
wtotal = 0; while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { for (bufp = buf, wresid = rcount; ; bufp += wcount, wresid -= wcount) { wcount = write(to_fd, bufp, wresid); if (wcount <= 0) break; wtotal += wcount; if (info) { info = 0; (void)fprintf(stderr, "%s -> %s %3d%%\n", entp->fts_path, to.p_path, cp_pct(wtotal, fs->st_size)); } if (wcount >= (ssize_t)wresid) break; } if (wcount != (ssize_t)wresid) { warn("%s", to.p_path); rval = 1; break; } }
open( argv[2], O_WRONLY|O_CREAT, 0)
ってやったらパーミッション00000のファイルができててワロタ。ls -lしたら ---------- kuenishi kuenishi ...ってなっててさらにワロタ。