From 2dfb72d278561b970a4083793b14767c8a3f2898 Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Tue, 16 Apr 2024 20:49:38 -0400 Subject: [PATCH] cleanup __paginate unlinking --- libc/x/paginate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/x/paginate.c b/libc/x/paginate.c index 73bc8065b..5b86705d0 100644 --- a/libc/x/paginate.c +++ b/libc/x/paginate.c @@ -70,17 +70,17 @@ void __paginate(int fd, const char *s) { char *args[3] = {0}; char tmppath[] = "/tmp/paginate.XXXXXX"; char progpath[PATH_MAX]; + bool done; if ((args[0] = get_pagerpath(progpath, sizeof(progpath)))) { if ((tfd = mkstemp(tmppath)) != -1) { - // defer((void*)unlink, tmppath); write(tfd, s, strlen(s)); close(tfd); args[1] = tmppath; - if (run_pager(args)) { - unlink(tmppath); + done = run_pager(args); + unlink(tmppath); + if (done) { return; } - unlink(tmppath); } } write(fd, s, strlen(s));