Lines Matching refs:to_fd
672 int devnull, from_fd, to_fd, serrno, tmpmode;
742 if ((to_fd = mkstemp(to_name)) == -1)
745 if ((to_fd = open(to_name,
756 copy(from_fd, from_name, to_fd, to_name, from_sb.st_size);
767 close(to_fd);
768 if ((to_fd = open(to_name, O_RDONLY, S_IRUSR | S_IWUSR)) < 0)
774 if (fstat(to_fd, &to_sb) != 0)
778 copy(to_fd, to_name, -1, NULL, size);
789 close(to_fd);
790 if ((to_fd = open(to_name, O_RDONLY, S_IRUSR | S_IWUSR)) < 0)
799 (flags & (HASUID | HASGID)) && fchown(to_fd, uid, gid) == -1) {
807 if (fchmod(to_fd, tmpmode) == -1) {
818 if (futimes(to_fd, tv) == -1)
826 (void)close(to_fd);
857 * If to_fd < 0, just calculate a digest, don't copy.
860 copy(int from_fd, char *from_name, int to_fd, char *to_name, off_t size)
893 if (to_fd < 0)
922 if (to_fd >= 0 && write(to_fd, p, size) != size) {
954 if (to_fd >= 0 &&
955 (nw = write(to_fd, buf, nr)) != nr) {