From 1b2e96f8302bb0eb80c30ec27ab13d4d0f1a7912 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 13 Nov 2004 01:02:48 +0000 Subject: [PATCH] Make the newly-introduced critical section a bit smaller. --- src/sort.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sort.c b/src/sort.c index 7c541d796..3b6cfb09b 100644 --- a/src/sort.c +++ b/src/sort.c @@ -528,11 +528,13 @@ zaptemp (const char *name) if (node->name == name) { /* Unlink the temporary file in a critical section, to avoid races. */ + struct tempnode *t = node->next; sigprocmask (SIG_BLOCK, &caught_signals, &oldset); unlink (name); - if (! (*pnode = node->next)) - temptail = pnode; + *pnode = t; sigprocmask (SIG_SETMASK, &oldset, NULL); + if (! t) + temptail = pnode; free (node); break; } -- 2.34.1