Lines Matching +full:tv +full:- +full:set

3 /*-
85 printf("%*s", INDENTNAMELEN - (int)len, ""); \
95 if (flags != p->fts_statp->st_flags) { \
99 sf = flags_to_string(p->fts_statp->st_flags, "none"); \
103 if (lchflags(p->fts_accpath, flags)) { \
115 * given pflags, additionally set those flags specified in s->st_flags and
120 flags = (s->st_flags & (mask)) | (pflags); \
125 * given pflags, reset the flags specified in s->st_flags and selected by mask
130 flags = (~(s->st_flags & (mask)) & CH_MASK) & (pflags); \
147 switch(s->type) { in compare()
149 if (!S_ISBLK(p->fts_statp->st_mode)) in compare()
153 if (!S_ISCHR(p->fts_statp->st_mode)) in compare()
157 if (!S_ISDIR(p->fts_statp->st_mode)) in compare()
161 if (!S_ISFIFO(p->fts_statp->st_mode)) in compare()
165 if (!S_ISREG(p->fts_statp->st_mode)) in compare()
169 if (!S_ISLNK(p->fts_statp->st_mode)) in compare()
174 if (!S_ISSOCK(p->fts_statp->st_mode)) in compare()
181 nodetype(s->type), inotype(p->fts_statp->st_mode)); in compare()
188 if (s->flags & F_FLAGS) in compare()
189 SETFLAGS(p->fts_statp->st_flags, SP_FLGS); in compare()
193 if (s->flags & F_FLAGS) in compare()
194 CLEARFLAGS(p->fts_statp->st_flags, SP_FLGS); in compare()
198 if (s->flags & F_DEV && in compare()
199 (s->type == F_BLOCK || s->type == F_CHAR) && in compare()
200 s->st_rdev != p->fts_statp->st_rdev) { in compare()
205 tab, (uintmax_t)s->st_rdev, in compare()
206 (uintmax_t)p->fts_statp->st_rdev); in compare()
208 if ((unlink(p->fts_accpath) == -1) || in compare()
209 (mknod(p->fts_accpath, in compare()
210 s->st_mode | nodetoino(s->type), in compare()
211 s->st_rdev) == -1) || in compare()
212 (lchown(p->fts_accpath, p->fts_statp->st_uid, in compare()
213 p->fts_statp->st_gid) == -1) ) in compare()
224 /* Set the uid/gid first, then set the mode. */ in compare()
225 if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) { in compare()
229 tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid); in compare()
231 if (lchown(p->fts_accpath, s->st_uid, -1)) in compare()
242 if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) { in compare()
246 tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid); in compare()
248 if (lchown(p->fts_accpath, -1, s->st_gid)) in compare()
260 if (s->flags & F_MODE && in compare()
261 s->st_mode != (p->fts_statp->st_mode & MBITS)) { in compare()
265 tmode = s->st_mode; in compare()
266 mode = p->fts_statp->st_mode & MBITS; in compare()
268 * if none of the suid/sgid/etc bits are set, in compare()
282 tab, (u_long)s->st_mode, in compare()
283 (u_long)p->fts_statp->st_mode & MBITS); in compare()
285 if (lchmod(p->fts_accpath, s->st_mode)) in compare()
298 if (s->flags & F_NLINK && s->type != F_DIR && in compare()
299 s->st_nlink != p->fts_statp->st_nlink) { in compare()
304 tab, (u_long)s->st_nlink, (u_long)p->fts_statp->st_nlink); in compare()
307 if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size) { in compare()
311 tab, (uintmax_t)s->st_size, in compare()
312 (uintmax_t)p->fts_statp->st_size); in compare()
323 if (s->flags & F_TIME) { in compare()
324 struct timeval tv[2]; in compare() local
325 struct stat *ps = p->fts_statp; in compare()
326 time_t smtime = s->st_mtimespec.tv_sec; in compare()
329 time_t pmtime = ps->st_mtimespec.tv_sec; in compare()
331 TIMESPEC_TO_TIMEVAL(&tv[0], &s->st_mtimespec); in compare()
332 TIMESPEC_TO_TIMEVAL(&tv[1], &ps->st_mtimespec); in compare()
334 time_t pmtime = (time_t)ps->st_mtime; in compare()
336 tv[0].tv_sec = smtime; in compare()
337 tv[0].tv_usec = 0; in compare()
338 tv[1].tv_sec = pmtime; in compare()
339 tv[1].tv_usec = 0; in compare()
342 if (tv[0].tv_sec != tv[1].tv_sec || in compare()
343 tv[0].tv_usec != tv[1].tv_usec) { in compare()
351 tv[1] = tv[0]; in compare()
352 if (utimes(p->fts_accpath, tv)) in compare()
371 if ((s->flags & F_FLAGS) && ((s->st_flags != p->fts_statp->st_flags) in compare()
373 if (s->st_flags != p->fts_statp->st_flags) { in compare()
376 f_s = flags_to_string(s->st_flags, "none"); in compare()
381 f_s = flags_to_string(p->fts_statp->st_flags, "none"); in compare()
403 if (s->flags & F_CKSUM) { in compare()
404 if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0) { in compare()
407 tab, p->fts_accpath, strerror(errno)); in compare()
413 tab, p->fts_accpath, strerror(errno)); in compare()
417 if (s->cksum != val) { in compare()
422 tab, s->cksum, (unsigned long)val); in compare()
428 if (s->flags & F_MD5) { in compare()
429 if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) { in compare()
432 tab, MD5KEY, p->fts_accpath, strerror(errno)); in compare()
435 if (strcmp(s->md5digest, digestbuf)) { in compare()
440 tab, MD5KEY, s->md5digest, digestbuf); in compare()
448 if (s->flags & F_RMD160) { in compare()
449 if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) { in compare()
452 tab, RMD160KEY, p->fts_accpath, strerror(errno)); in compare()
455 if (strcmp(s->rmd160digest, digestbuf)) { in compare()
460 tab, RMD160KEY, s->rmd160digest, digestbuf); in compare()
468 if (s->flags & F_SHA1) { in compare()
469 if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) { in compare()
472 tab, SHA1KEY, p->fts_accpath, strerror(errno)); in compare()
475 if (strcmp(s->sha1digest, digestbuf)) { in compare()
480 tab, SHA1KEY, s->sha1digest, digestbuf); in compare()
488 if (s->flags & F_SHA256) { in compare()
489 if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) { in compare()
492 tab, SHA256KEY, p->fts_accpath, strerror(errno)); in compare()
495 if (strcmp(s->sha256digest, digestbuf)) { in compare()
500 tab, SHA256KEY, s->sha256digest, digestbuf); in compare()
507 if (s->flags & F_SHA384) { in compare()
508 if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) { in compare()
511 tab, SHA384KEY, p->fts_accpath, strerror(errno)); in compare()
514 if (strcmp(s->sha384digest, digestbuf)) { in compare()
519 tab, SHA384KEY, s->sha384digest, digestbuf); in compare()
526 if (s->flags & F_SHA512) { in compare()
527 if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) { in compare()
530 tab, SHA512KEY, p->fts_accpath, strerror(errno)); in compare()
533 if (strcmp(s->sha512digest, digestbuf)) { in compare()
538 tab, SHA512KEY, s->sha512digest, digestbuf); in compare()
545 if (s->flags & F_SLINK && in compare()
546 strcmp(cp = rlink(p->fts_accpath), s->slink)) { in compare()
550 "%slink ref (%s, %s", tab, cp, s->slink); in compare()
552 if ((unlink(p->fts_accpath) == -1) || in compare()
553 (symlink(s->slink, p->fts_accpath) == -1) ) in compare()
572 if ((len = readlink(name, lbuf, sizeof(lbuf) - 1)) == -1) in rlink()