| 1 | # Stop the error message: |
| 2 | $ nvi |
| 3 | ./en_US.UTF-8: No such file or directory |
| 4 | $ |
| 5 | |
| 6 | --- ../common/msg.c-dist 2007-11-18 10:41:42.000000000 -0600 |
| 7 | +++ ../common/msg.c 2010-08-29 19:14:20.000000000 -0500 |
| 8 | @@ -715,7 +715,7 @@ |
| 9 | DB *db; |
| 10 | DBT data, key; |
| 11 | db_recno_t msgno; |
| 12 | - char *p, *t, buf[MAXPATHLEN]; |
| 13 | + char *p, *p2, *t, buf[MAXPATHLEN]; |
| 14 | |
| 15 | if ((p = strrchr(file, '/')) != NULL && p[1] == '\0' && |
| 16 | (((t = getenv("LC_MESSAGES")) != NULL && t[0] != '\0') || |
| 17 | @@ -724,16 +724,15 @@ |
| 18 | p = buf; |
| 19 | } else |
| 20 | p = file; |
| 21 | - if ((sp->db_error = db_create(&db, 0, 0)) != 0 || |
| 22 | - (sp->db_error = db->set_re_source(db, p)) != 0 || |
| 23 | - (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) { |
| 24 | - if (first) { |
| 25 | - first = 0; |
| 26 | - return (1); |
| 27 | - } |
| 28 | - msgq_str(sp, M_DBERR, p, "%s"); |
| 29 | - return (1); |
| 30 | - } |
| 31 | + |
| 32 | + p2 = "%s"; |
| 33 | + if ((sp->db_error = db_create(&db, 0, 0)) == 0 && |
| 34 | + (sp->db_error = db->set_re_source(db, p)) == 0) { |
| 35 | + db->set_errcall(db, 0); |
| 36 | + if ((sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) |
| 37 | + goto err; |
| 38 | + } else |
| 39 | + goto err; |
| 40 | |
| 41 | /* |
| 42 | * Test record 1 for the magic string. The msgq call is here so |
| 43 | @@ -749,13 +748,8 @@ |
| 44 | data.size != sizeof(VMC) - 1 || |
| 45 | memcmp(data.data, VMC, sizeof(VMC) - 1)) { |
| 46 | (void)db->close(db, DB_NOSYNC); |
| 47 | - if (first) { |
| 48 | - first = 0; |
| 49 | - return (1); |
| 50 | - } |
| 51 | - msgq_str(sp, M_DBERR, p, |
| 52 | - "030|The file %s is not a message catalog"); |
| 53 | - return (1); |
| 54 | + p2 = "030|The file %s is not a message catalog"; |
| 55 | + goto err; |
| 56 | } |
| 57 | first = 0; |
| 58 | |
| 59 | @@ -763,6 +757,14 @@ |
| 60 | (void)sp->gp->msg->close(sp->gp->msg, DB_NOSYNC); |
| 61 | sp->gp->msg = db; |
| 62 | return (0); |
| 63 | + |
| 64 | +err: |
| 65 | + if (first) { |
| 66 | + first = 0; |
| 67 | + return (1); |
| 68 | + } |
| 69 | + msgq_str(sp, M_DBERR, p, p2); |
| 70 | + return (1); |
| 71 | } |
| 72 | |
| 73 | /* |