diff options
author | fhajny <fhajny@pkgsrc.org> | 2017-04-04 07:53:23 +0000 |
---|---|---|
committer | fhajny <fhajny@pkgsrc.org> | 2017-04-04 07:53:23 +0000 |
commit | f126e8308ca8f16d0c3c2648e0c82ac44d99bdb6 (patch) | |
tree | 13809627f74e8cae9efa5a5d114470d8900219d3 /editors/nvi/patches/patch-common_msg.c | |
parent | 36d754f0a2ea2664e35c86209932a39e6cb994d1 (diff) | |
download | pkgsrc-f126e8308ca8f16d0c3c2648e0c82ac44d99bdb6.tar.gz |
Fix an issue with editor segfaulting in ex mode on Darwin and suppress benign stderr output regarding locale. Reported in joyent/pkgsrc/issues/402, patch provided by @bjcooke in joyent/pkgsrc/pull/463. Bump PKGREVISION.
Diffstat (limited to 'editors/nvi/patches/patch-common_msg.c')
-rw-r--r-- | editors/nvi/patches/patch-common_msg.c | 80 |
1 files changed, 68 insertions, 12 deletions
diff --git a/editors/nvi/patches/patch-common_msg.c b/editors/nvi/patches/patch-common_msg.c index 19a3d31566b..84cfa588bd5 100644 --- a/editors/nvi/patches/patch-common_msg.c +++ b/editors/nvi/patches/patch-common_msg.c @@ -1,14 +1,70 @@ -$NetBSD: patch-common_msg.c,v 1.1 2015/05/11 08:43:44 enami Exp $ +$NetBSD: patch-common_msg.c,v 1.2 2017/04/04 07:53:23 fhajny Exp $ ---- common/msg.c.orig 2007-11-18 16:41:42.000000000 +0000 +--- common/msg.c.orig 2017-04-03 15:17:07.396452540 +0000 +++ common/msg.c -@@ -640,7 +640,8 @@ msgq_status(SCR *sp, db_recno_t lno, u_i - p += len; - } else { - t = msg_cat(sp, "027|line %lu of %lu [%ld%%]", &len); -- (void)sprintf(p, t, lno, last, (lno * 100) / last); -+ (void)sprintf(p, t, (u_long)lno, (u_long)last, -+ (long)((lno * 100) / last)); - p += strlen(p); - } - } else { +@@ -716,7 +716,7 @@ msg_open(SCR *sp, char *file) + DB *db; + DBT data, key; + db_recno_t msgno; +- char *p, *t, buf[MAXPATHLEN]; ++ char *p, *p2, *t, buf[MAXPATHLEN]; + + if ((p = strrchr(file, '/')) != NULL && p[1] == '\0' && + (((t = getenv("LC_MESSAGES")) != NULL && t[0] != '\0') || +@@ -725,16 +725,15 @@ msg_open(SCR *sp, char *file) + p = buf; + } else + p = file; +- if ((sp->db_error = db_create(&db, 0, 0)) != 0 || +- (sp->db_error = db->set_re_source(db, p)) != 0 || +- (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) { +- if (first) { +- first = 0; +- return (1); +- } +- msgq_str(sp, M_DBERR, p, "%s"); +- return (1); +- } ++ ++ p2 = "%s"; ++ if ((sp->db_error = db_create(&db, 0, 0)) == 0 && ++ (sp->db_error = db->set_re_source(db, p)) == 0) { ++ db->set_errcall(db, 0); ++ if ((sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) ++ goto err; ++ } else ++ goto err; + + /* + * Test record 1 for the magic string. The msgq call is here so +@@ -750,13 +749,8 @@ msg_open(SCR *sp, char *file) + data.size != sizeof(VMC) - 1 || + memcmp(data.data, VMC, sizeof(VMC) - 1)) { + (void)db->close(db, DB_NOSYNC); +- if (first) { +- first = 0; +- return (1); +- } +- msgq_str(sp, M_DBERR, p, +- "030|The file %s is not a message catalog"); +- return (1); ++ p2 = "030|The file %s is not a message catalog"; ++ goto err; + } + first = 0; + +@@ -764,6 +758,14 @@ msg_open(SCR *sp, char *file) + (void)sp->gp->msg->close(sp->gp->msg, DB_NOSYNC); + sp->gp->msg = db; + return (0); ++ ++err: ++ if (first) { ++ first = 0; ++ return (1); ++ } ++ msgq_str(sp, M_DBERR, p, p2); ++ return (1); + } + + /* |