You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.2 KiB

  1. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889170
  2. # needs to be submitted upstream
  3. --- a/dbm/apr_dbm_gdbm.c
  4. +++ b/dbm/apr_dbm_gdbm.c
  5. @@ -36,13 +36,22 @@
  6. static apr_status_t g2s(int gerr)
  7. {
  8. if (gerr == -1) {
  9. - /* ### need to fix this */
  10. - return APR_EGENERAL;
  11. + return APR_OS_START_USEERR + gdbm_errno;
  12. }
  13. return APR_SUCCESS;
  14. }
  15. +static apr_status_t gdat2s(datum d)
  16. +{
  17. + if (d.dptr == NULL) {
  18. + return APR_OS_START_USEERR + gdbm_errno;
  19. + }
  20. +
  21. + return APR_SUCCESS;
  22. +}
  23. +
  24. +
  25. static apr_status_t datum_cleanup(void *dptr)
  26. {
  27. if (dptr)
  28. @@ -55,19 +64,15 @@ static apr_status_t set_error(apr_dbm_t
  29. {
  30. apr_status_t rv = APR_SUCCESS;
  31. - /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
  32. -
  33. - if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
  34. + if (dbm_said == APR_SUCCESS) {
  35. + dbm->errcode = GDBM_NO_ERROR;
  36. dbm->errmsg = NULL;
  37. }
  38. else {
  39. + dbm->errcode = dbm_said;
  40. dbm->errmsg = gdbm_strerror(gdbm_errno);
  41. - rv = APR_EGENERAL; /* ### need something better */
  42. }
  43. - /* captured it. clear it now. */
  44. - gdbm_errno = GDBM_NO_ERROR;
  45. -
  46. return rv;
  47. }
  48. @@ -144,7 +149,7 @@ static apr_status_t vt_gdbm_fetch(apr_db
  49. /* store the error info into DBM, and return a status code. Also, note
  50. that *pvalue should have been cleared on error. */
  51. - return set_error(dbm, APR_SUCCESS);
  52. + return set_error(dbm, gdat2s(rd));
  53. }
  54. static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key,
  55. @@ -203,7 +208,7 @@ static apr_status_t vt_gdbm_firstkey(apr
  56. apr_pool_cleanup_null);
  57. /* store any error info into DBM, and return a status code. */
  58. - return set_error(dbm, APR_SUCCESS);
  59. + return set_error(dbm, gdat2s(rd));
  60. }
  61. static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
  62. @@ -223,7 +228,7 @@ static apr_status_t vt_gdbm_nextkey(apr_
  63. apr_pool_cleanup_null);
  64. /* store any error info into DBM, and return a status code. */
  65. - return set_error(dbm, APR_SUCCESS);
  66. + return set_error(dbm, gdat2s(rd));
  67. }
  68. static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)