=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/worklist.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/cvs/worklist.c 2006/03/08 20:18:41 1.1 --- src/usr.bin/cvs/worklist.c 2006/03/10 00:48:56 1.2 *************** *** 1,4 **** ! /* $OpenBSD: worklist.c,v 1.1 2006/03/08 20:18:41 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: worklist.c,v 1.2 2006/03/10 00:48:56 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * All rights reserved. *************** *** 61,88 **** cvs_worklist_run(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) { sigset_t old, new; sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); cvs_worklist_clean(list, cb); sigprocmask(SIG_SETMASK, &old, NULL); } /* ! * clean the worklist by passing the elements to the specified callback */ void cvs_worklist_clean(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) { struct cvs_worklist *wkl; ! while ((wkl = SLIST_FIRST(list)) != NULL) { ! SLIST_REMOVE_HEAD(list, wkl_list); cb(wkl); - xfree(wkl); - } } void --- 61,91 ---- cvs_worklist_run(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) { sigset_t old, new; + struct cvs_worklist *wkl; sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); cvs_worklist_clean(list, cb); + while ((wkl = SLIST_FIRST(list)) != NULL) { + SLIST_REMOVE_HEAD(list, wkl_list); + xfree(wkl); + } + sigprocmask(SIG_SETMASK, &old, NULL); } /* ! * pass elements to the specified callback, which has to be signal safe. */ void cvs_worklist_clean(struct cvs_wklhead *list, void (*cb)(struct cvs_worklist *)) { struct cvs_worklist *wkl; ! while ((wkl = SLIST_FIRST(list)) != NULL) cb(wkl); } void