• Home
  • Raw
  • Download

Lines Matching refs:try

97   int (*callback)(struct dirtree *try);
104 int cp_node(struct dirtree *try)
106 int fdout = -1, cfd = try->parent ? try->parent->extra : AT_FDCWD,
107 tfd = dirtree_parentfd(try);
109 char *catch = try->parent ? try->name : TT.destname, *err = "%s";
112 if (!dirtree_notdotdot(try)) return 0;
115 if (S_ISDIR(try->st.st_mode) && try->again) {
116 fdout = try->extra;
121 if (S_ISLNK(try->st.st_mode) && (flags & FLAG_d)) flags |= FLAG_r;
125 if ((TT.top.st_dev == try->st.st_dev && TT.top.st_ino == try->st.st_ino
127 || (!fstatat(cfd, catch, &cst, 0) && cst.st_dev == try->st.st_dev
128 && cst.st_ino == try->st.st_ino))
130 error_msg("'%s' is '%s'", catch, err = dirtree_path(try, 0));
141 if (S_ISDIR(try->st.st_dev)) {
142 error_msg("dir at '%s'", s = dirtree_path(try, 0));
151 s = dirtree_path(try, 0));
158 char *s = dirtree_path(try, 0);
170 if (S_ISDIR(try->st.st_mode)) {
175 catch = try->name;
186 if (!mkdirat(cfd, catch, try->st.st_mode | 0200) || errno == EEXIST)
187 if (-1 != (try->extra = openat(cfd, catch, O_NOFOLLOW)))
188 if (!fstat(try->extra, &st2) && S_ISDIR(st2.st_mode))
195 if (!linkat(tfd, try->name, cfd, catch, 0)) err = 0;
205 s = dirtree_path(try, 0);
206 for (or = try; or->parent; or = or->parent) dotdots++;
225 } else if (!S_ISREG(try->st.st_mode)
226 && (try->parent || (flags & (FLAG_a|FLAG_r))))
231 if (S_ISLNK(try->st.st_mode)
232 ? (0 < (i = readlinkat(tfd, try->name, toybuf, sizeof(toybuf))) &&
234 : !mknodat(cfd, catch, try->st.st_mode, try->st.st_rdev))
244 fdin = openat(tfd, try->name, O_RDONLY);
246 catch = try->name;
249 fdout = openat(cfd, catch, O_RDWR|O_CREAT|O_TRUNC, try->st.st_mode);
267 times[0] = try->st.st_atim;
268 times[1] = try->st.st_mtim;
272 rc = fchownat(cfd, catch, try->st.st_uid, try->st.st_gid,
274 else rc = fchown(fdout, try->st.st_uid, try->st.st_gid);
278 perror_msg("chown '%s'", pp = dirtree_path(try, 0));
286 fchmod(fdout, try->st.st_mode);
293 if (unlinkat(tfd, try->name, S_ISDIR(try->st.st_mode) ? AT_REMOVEDIR :0))
361 static int install_node(struct dirtree *try) in install_node() argument
363 if (TT.mode) try->st.st_mode = string_to_mode(TT.mode, try->st.st_mode); in install_node()
364 if (TT.group) try->st.st_gid = TT.gid; in install_node()
365 if (TT.user) try->st.st_uid = TT.uid; in install_node()
368 cp_node(try); in install_node()