From: Jeremy Mates Subject: vi - remove unused file_lock arguments To: tech@openbsd.org Date: Tue, 14 Jan 2025 19:57:13 +0000 *fdp and iswrite being leftover from some prior version? Index: common/exf.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/exf.c,v diff -u -p -r1.50 exf.c --- common/exf.c 15 Feb 2024 00:55:01 -0000 1.50 +++ common/exf.c 14 Jan 2025 19:43:27 -0000 @@ -341,8 +341,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_ * an error. */ if (rcv_name == NULL && !O_ISSET(sp, O_READONLY)) - switch (file_lock(sp, oname, - &ep->fcntl_fd, ep->db->fd(ep->db), 0)) { + switch (file_lock(sp, oname, ep->db->fd(ep->db))) { case LOCK_FAILED: F_SET(frp, FR_UNLOCKED); break; @@ -831,7 +830,7 @@ file_write(SCR *sp, MARK *fm, MARK *tm, } /* Try and get a lock. */ - if (!noname && file_lock(sp, NULL, NULL, fd, 0) == LOCK_UNAVAIL) + if (!noname && file_lock(sp, NULL, fd) == LOCK_UNAVAIL) msgq_str(sp, M_ERR, name, "%s: write lock was unavailable"); @@ -1379,10 +1378,10 @@ set_alt_name(SCR *sp, char *name) * file_lock -- * Get an exclusive lock on a file. * - * PUBLIC: lockr_t file_lock(SCR *, char *, int *, int, int); + * PUBLIC: lockr_t file_lock(SCR *, char *, int); */ lockr_t -file_lock(SCR *sp, char *name, int *fdp, int fd, int iswrite) +file_lock(SCR *sp, char *name, int fd) { if (!O_ISSET(sp, O_LOCKFILES)) return (LOCK_SUCCESS); Index: common/recover.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/recover.c,v diff -u -p -r1.32 recover.c --- common/recover.c 20 Feb 2022 19:45:51 -0000 1.32 +++ common/recover.c 14 Jan 2025 19:43:27 -0000 @@ -349,7 +349,7 @@ rcv_mailfile(SCR *sp, int issync, char * * and the lock, but it's pretty small. */ ep = sp->ep; - if (file_lock(sp, NULL, NULL, fd, 1) != LOCK_SUCCESS) + if (file_lock(sp, NULL, fd) != LOCK_SUCCESS) msgq(sp, M_SYSERR, "Unable to lock recovery file"); if (!issync) { /* Save the recover file descriptor, and mail path. */ @@ -483,7 +483,7 @@ rcv_openat(SCR *sp, int dfd, const char if (locked == NULL) locked = &dummy; - switch ((*locked = file_lock(sp, NULL, NULL, fd, 0))) { + switch ((*locked = file_lock(sp, NULL, fd))) { case LOCK_FAILED: /* * XXX Index: ex/ex_read.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_read.c,v diff -u -p -r1.14 ex_read.c --- ex/ex_read.c 18 Apr 2017 01:45:35 -0000 1.14 +++ ex/ex_read.c 14 Jan 2025 19:43:27 -0000 @@ -261,7 +261,7 @@ ex_read(SCR *sp, EXCMD *cmdp) } /* Try and get a lock. */ - if (file_lock(sp, NULL, NULL, fileno(fp), 0) == LOCK_UNAVAIL) + if (file_lock(sp, NULL, fileno(fp)) == LOCK_UNAVAIL) msgq(sp, M_ERR, "%s: read lock was unavailable", name); rval = ex_readfp(sp, name, fp, &cmdp->addr1, &nlines, 0); Index: include/com_extern.h =================================================================== RCS file: /cvs/src/usr.bin/vi/include/com_extern.h,v diff -u -p -r1.16 com_extern.h --- include/com_extern.h 21 May 2019 09:24:58 -0000 1.16 +++ include/com_extern.h 14 Jan 2025 19:43:27 -0000 @@ -16,7 +16,7 @@ int file_m2(SCR *, int); int file_m3(SCR *, int); int file_aw(SCR *, int); void set_alt_name(SCR *, char *); -lockr_t file_lock(SCR *, char *, int *, int, int); +lockr_t file_lock(SCR *, char *, int); int v_key_init(SCR *); void v_key_ilookup(SCR *); size_t v_key_len(SCR *, CHAR_T);