Lines Matching refs:st
140 static int fd_copy_symlink(int df, const char *from, const struct stat *st, int dt, const char *to) {
145 assert(st);
155 if (fchownat(dt, to, st->st_uid, st->st_gid, AT_SYMLINK_NOFOLLOW) < 0)
161 static int fd_copy_regular(int df, const char *from, const struct stat *st, int dt, const char *to) {
167 assert(st);
174 fdt = openat(dt, to, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, st->st_mode & 07777);
184 if (fchown(fdt, st->st_uid, st->st_gid) < 0)
187 if (fchmod(fdt, st->st_mode & 07777) < 0)
190 ts[0] = st->st_atim;
191 ts[1] = st->st_mtim;
207 static int fd_copy_fifo(int df, const char *from, const struct stat *st, int dt, const char *to) {
211 assert(st);
214 r = mkfifoat(dt, to, st->st_mode & 07777);
218 if (fchownat(dt, to, st->st_uid, st->st_gid, AT_SYMLINK_NOFOLLOW) < 0)
221 if (fchmodat(dt, to, st->st_mode & 07777, 0) < 0)
227 static int fd_copy_node(int df, const char *from, const struct stat *st, int dt, const char *to) {
231 assert(st);
234 r = mknodat(dt, to, st->st_mode, st->st_rdev);
238 if (fchownat(dt, to, st->st_uid, st->st_gid, AT_SYMLINK_NOFOLLOW) < 0)
241 if (fchmodat(dt, to, st->st_mode & 07777, 0) < 0)
250 const struct stat *st,
262 assert(st);
275 r = mkdirat(dt, to, st->st_mode & 07777);
291 st->st_atim,
292 st->st_mtim
295 if (fchown(fdt, st->st_uid, st->st_gid) < 0)
298 if (fchmod(fdt, st->st_mode & 07777) < 0)
344 struct stat st;
349 if (fstatat(fdf, from, &st, AT_SYMLINK_NOFOLLOW) < 0)
352 if (S_ISREG(st.st_mode))
353 return fd_copy_regular(fdf, from, &st, fdt, to);
354 else if (S_ISDIR(st.st_mode))
355 return fd_copy_directory(fdf, from, &st, fdt, to, st.st_dev, merge);
356 else if (S_ISLNK(st.st_mode))
357 return fd_copy_symlink(fdf, from, &st, fdt, to);
358 else if (S_ISFIFO(st.st_mode))
359 return fd_copy_fifo(fdf, from, &st, fdt, to);
360 else if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))
361 return fd_copy_node(fdf, from, &st, fdt, to);
372 struct stat st;
377 if (fstat(dirfd, &st) < 0)
380 if (!S_ISDIR(st.st_mode))
383 return fd_copy_directory(dirfd, NULL, &st, AT_FDCWD, to, st.st_dev, merge);
466 struct stat st;
472 if (fstat(fdf, &st) < 0)
475 ut[0] = st.st_atim;
476 ut[1] = st.st_mtim;