Lines Matching defs:file2
787 char file1[PATH_MAX], file2[PATH_MAX], *suffix;
794 (void)snprintf(file2, sizeof(file2), "%s.%d%s", oldlog,
797 printf("\trm -f %s %s\n", file1, file2);
798 done = access(file1, 0) && access(file2, 0);
800 done = unlink(file1) && unlink(file2);
815 (void)snprintf(file2, sizeof(file2), "%s.%d%s", oldlog,
819 printf("\tmv %s %s\n", file1, file2);
820 printf("\tchmod %o %s\n", ent->permissions, file2);
821 printf("\tchown %u:%u %s\n", ent->uid, ent->gid, file2);
823 if (rename(file1, file2))
824 warn("can't mv %s to %s", file1, file2);
825 if (chmod(file2, ent->permissions))
826 warn("can't chmod %s", file2);
827 if (chown(file2, ent->uid, ent->gid))
828 warn("can't chown %s", file2);
836 char file1[PATH_MAX], file2[PATH_MAX], oldlog[PATH_MAX];
851 (void)snprintf(file2, sizeof(file2), "%s.XXXXXXXXXX", ent->log);
853 printf("\tmktemp %s\n", file2);
855 if ((fd = mkstemp(file2)) == -1)
856 err(1, "can't start '%s' log", file2);
858 err(1, "can't chmod '%s' log file", file2);
860 err(1, "can't chown '%s' log file", file2);
863 if (!(ent->flags & CE_BINARY) && log_trim(file2))
864 err(1, "can't add status message to log '%s'", file2);
885 printf("\tmv %s to %s\n", file2, ent->log);
886 else if (rename(file2, ent->log))
887 warn("can't mv %s to %s", file2, ent->log);