tempfile
extern char *tempfile;
tempfile = malloc(tdlen + 1 + sizeof(_TFILE_BASE));
if (tempfile == NULL) {
memcpy(tempfile, tmpdir, tdlen);
tempbase = tempfile + tdlen;
char *tempfile; /* tempfile to use for mkstemp(3) */
if ((dirfd = mkstemp(tempfile)) >= 0) {
(void)unlink(tempfile);
tempfile);
if ((ffd = mkstemp(tempfile)) < 0) {
tempfile);
(void)unlink(tempfile);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd);
tempfile(&putfd_1);
tempfile(&putfd_2);
tempfile(&putfd);
char buf[BUFSIZ], tempfile[PATH_MAX];
(void)strlcpy(tempfile, _PATH_TMP "/diff.XXXXXXXX", sizeof(tempfile));
if ((ofd = mkstemp(tempfile)) == -1) {
unlink(tempfile);
char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
to_fd = create_tempfile(to_name, tempfile,
sizeof(tempfile));
err(EX_OSERR, "%s", dirname(tempfile));
stripped = strip(tempfile, to_fd, from_name,
tempfile);
(void)strip(tempfile, to_fd, NULL, &digestresult);
to_fd = open(tempfile, O_RDONLY, 0);
(void)unlink(tempfile);
err(EX_OSERR, "%s", tempfile);
if (compare(temp_fd, tempfile, (size_t)temp_sb.st_size, to_fd,
(void)utimensat(AT_FDCWD, tempfile, tsb, 0);
(void)unlink(tempfile);
digestresult = digest_file(tempfile);
unlink(tempfile);
unlink(tempfile);
unlink(tempfile);
if (rename(tempfile, to_name) < 0) {
unlink(tempfile);
tempfile, to_name);
char *realfile, *slash, tempfile[MAXPATHLEN];
strlcpy(tempfile, realfile, sizeof(tempfile));
slash = strrchr(tempfile, '/');
failed = stat(tempfile, &st);
err(1, "Error on stat(%s)", tempfile);
createdir(ent, tempfile);
tempfile);
strlcpy(tempfile, realfile, sizeof(tempfile));
strlcat(tempfile, ".zXXXXXX", sizeof(tempfile));
printf("\tmktemp %s\n", tempfile);
fd = mkstemp(tempfile);
err(1, "can't mkstemp logfile %s", tempfile);
if (log_trim(tempfile, ent))
tempfile);
err(1, "can't fchown temp file %s", tempfile);
printf("\tchflags nodump %s\n", tempfile);
printf("\tchmod %o %s\n", ent->permissions, tempfile);
printf("\tmv %s %s\n", tempfile, realfile);
err(1, "can't fchmod temp file '%s'", tempfile);
failed = rename(tempfile, realfile);
err(1, "can't mv %s to %s", tempfile, realfile);