nvi-1.81.6-db44.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. First part is adapted from http://cvsweb.se.netbsd.org/cgi-bin/bsdweb.cgi/pkgsrc/editors/nvi/patches/patch-aa?rev=1.3;content-type=text/plain
  2. --- a/common/db.h
  3. +++ b/common/db.h
  4. @@ -4,7 +4,7 @@
  5. #define DB_BUFFER_SMALL ENOMEM
  6. #endif
  7. -#if DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1
  8. +#if (DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR > 3
  9. #define db_env_open(env,path,flags,mode) \
  10. (env)->open(env, path, flags, mode)
  11. #define db_env_remove(env,path,flags) \
  12. @@ -16,7 +16,10 @@
  13. (env)->remove(env, path, NULL, flags)
  14. #endif
  15. -#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
  16. +# if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 4) || DB_VERSION_MAJOR > 4
  17. +#define db_open(db,file,type,flags,mode) \
  18. + (db)->open(db, NULL, file, NULL, type, flags | DB_CREATE, mode)
  19. +#elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
  20. #define db_open(db,file,type,flags,mode) \
  21. (db)->open(db, NULL, file, NULL, type, flags, mode)
  22. #else
  23. --- a/common/msg.c
  24. +++ b/common/msg.c
  25. @@ -724,7 +724,8 @@
  26. p = buf;
  27. } else
  28. p = file;
  29. - if ((sp->db_error = db_create(&db, 0, 0)) != 0 ||
  30. + if (access(p, R_OK) != 0 ||
  31. + (sp->db_error = db_create(&db, 0, 0)) != 0 ||
  32. (sp->db_error = db->set_re_source(db, p)) != 0 ||
  33. (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) {
  34. if (first) {