mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 17:30:27 +00:00
cleanup __paginate unlinking
This commit is contained in:
parent
346a78ddc0
commit
2dfb72d278
1 changed files with 4 additions and 4 deletions
|
@ -70,17 +70,17 @@ void __paginate(int fd, const char *s) {
|
||||||
char *args[3] = {0};
|
char *args[3] = {0};
|
||||||
char tmppath[] = "/tmp/paginate.XXXXXX";
|
char tmppath[] = "/tmp/paginate.XXXXXX";
|
||||||
char progpath[PATH_MAX];
|
char progpath[PATH_MAX];
|
||||||
|
bool done;
|
||||||
if ((args[0] = get_pagerpath(progpath, sizeof(progpath)))) {
|
if ((args[0] = get_pagerpath(progpath, sizeof(progpath)))) {
|
||||||
if ((tfd = mkstemp(tmppath)) != -1) {
|
if ((tfd = mkstemp(tmppath)) != -1) {
|
||||||
// defer((void*)unlink, tmppath);
|
|
||||||
write(tfd, s, strlen(s));
|
write(tfd, s, strlen(s));
|
||||||
close(tfd);
|
close(tfd);
|
||||||
args[1] = tmppath;
|
args[1] = tmppath;
|
||||||
if (run_pager(args)) {
|
done = run_pager(args);
|
||||||
unlink(tmppath);
|
unlink(tmppath);
|
||||||
|
if (done) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unlink(tmppath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write(fd, s, strlen(s));
|
write(fd, s, strlen(s));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue