=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/worklist.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/rcs/worklist.c 2007/02/27 07:59:13 1.2 --- src/usr.bin/rcs/worklist.c 2010/07/23 08:31:19 1.3 *************** *** 1,4 **** ! /* $OpenBSD: worklist.c,v 1.2 2007/02/27 07:59:13 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: worklist.c,v 1.3 2010/07/23 08:31:19 ray Exp $ */ /* * Copyright (c) 2006 Joris Vink * All rights reserved. *************** *** 38,54 **** * adds a path to a worklist. */ void ! rcs_worklist_add(const char *path, struct rcs_wklhead *worklist) { size_t len; ! struct rcs_worklist *wkl; sigset_t old, new; wkl = xcalloc(1, sizeof(*wkl)); len = strlcpy(wkl->wkl_path, path, sizeof(wkl->wkl_path)); if (len >= sizeof(wkl->wkl_path)) ! errx(1, "path truncation in rcs_worklist_add"); sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); --- 38,54 ---- * adds a path to a worklist. */ void ! worklist_add(const char *path, struct wklhead *worklist) { size_t len; ! struct worklist *wkl; sigset_t old, new; wkl = xcalloc(1, sizeof(*wkl)); len = strlcpy(wkl->wkl_path, path, sizeof(wkl->wkl_path)); if (len >= sizeof(wkl->wkl_path)) ! errx(1, "path truncation in worklist_add"); sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); *************** *** 58,75 **** /* * run over the given worklist, calling cb for each element. ! * this is just like rcs_worklist_clean(), except we block signals first. */ void ! rcs_worklist_run(struct rcs_wklhead *list, void (*cb)(struct rcs_worklist *)) { sigset_t old, new; ! struct rcs_worklist *wkl; sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); ! rcs_worklist_clean(list, cb); while ((wkl = SLIST_FIRST(list)) != NULL) { SLIST_REMOVE_HEAD(list, wkl_list); --- 58,75 ---- /* * run over the given worklist, calling cb for each element. ! * this is just like worklist_clean(), except we block signals first. */ void ! worklist_run(struct wklhead *list, void (*cb)(struct worklist *)) { sigset_t old, new; ! struct worklist *wkl; sigfillset(&new); sigprocmask(SIG_BLOCK, &new, &old); ! worklist_clean(list, cb); while ((wkl = SLIST_FIRST(list)) != NULL) { SLIST_REMOVE_HEAD(list, wkl_list); *************** *** 83,98 **** * pass elements to the specified callback, which has to be signal safe. */ void ! rcs_worklist_clean(struct rcs_wklhead *list, void (*cb)(struct rcs_worklist *)) { ! struct rcs_worklist *wkl; SLIST_FOREACH(wkl, list, wkl_list) cb(wkl); } void ! rcs_worklist_unlink(struct rcs_worklist *wkl) { (void)unlink(wkl->wkl_path); } --- 83,98 ---- * pass elements to the specified callback, which has to be signal safe. */ void ! worklist_clean(struct wklhead *list, void (*cb)(struct worklist *)) { ! struct worklist *wkl; SLIST_FOREACH(wkl, list, wkl_list) cb(wkl); } void ! worklist_unlink(struct worklist *wkl) { (void)unlink(wkl->wkl_path); }