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.

114 lines
3.5 KiB

  1. From ad8c3353b8e482575ff2208182290cf35b624dde Mon Sep 17 00:00:00 2001
  2. From: Chris Leech <cleech@redhat.com>
  3. Date: Wed, 5 Jun 2019 09:08:39 -0700
  4. Subject: [PATCH 1/1] Coverity scan fixes
  5. ---
  6. iscsiuio/src/unix/libs/qedi.c | 2 +-
  7. iscsiuio/src/unix/main.c | 3 +++
  8. libopeniscsiusr/idbm.c | 11 +++++------
  9. usr/idbm.c | 10 ++++------
  10. usr/initiator.c | 2 +-
  11. usr/iscsid.c | 2 +-
  12. 6 files changed, 15 insertions(+), 15 deletions(-)
  13. diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
  14. index 3414cb5..a359700 100644
  15. --- a/iscsiuio/src/unix/libs/qedi.c
  16. +++ b/iscsiuio/src/unix/libs/qedi.c
  17. @@ -1023,7 +1023,7 @@ static int qedi_read(nic_t *nic, packet_t *pkt)
  18. LOG_DEBUG(PFX "%s:hw_prod %d bd_prod %d, rx_pkt_idx %d, rxlen %d",
  19. nic->log_name, hw_prod, bd_prod, rx_bd->rx_pkt_index, len);
  20. - LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %d",
  21. + LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %lu",
  22. nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD);
  23. if (bd_cons != bd_prod) {
  24. diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
  25. index 0c9ad49..f83f305 100644
  26. --- a/iscsiuio/src/unix/main.c
  27. +++ b/iscsiuio/src/unix/main.c
  28. @@ -391,6 +391,9 @@ int main(int argc, char *argv[])
  29. sigaddset(&set, SIGTERM);
  30. sigaddset(&set, SIGUSR1);
  31. rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
  32. + if (rc != 0) {
  33. + LOG_ERR("Failed to set thread signal mask");
  34. + }
  35. /* Spin off the signal handling thread */
  36. pthread_attr_init(&attr);
  37. diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
  38. index 7bc2381..7d4c338 100644
  39. --- a/libopeniscsiusr/idbm.c
  40. +++ b/libopeniscsiusr/idbm.c
  41. @@ -321,12 +321,11 @@ int _idbm_lock(struct iscsi_context *ctx)
  42. return 0;
  43. }
  44. - if (access(LOCK_DIR, F_OK) != 0) {
  45. - if (mkdir(LOCK_DIR, 0660) != 0) {
  46. - _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
  47. - _strerror(errno, strerr_buff));
  48. - return LIBISCSI_ERR_IDBM;
  49. - }
  50. + if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) ||
  51. + (access(LOCK_DIR, F_OK) != 0)) {
  52. + _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
  53. + _strerror(errno, strerr_buff));
  54. + return LIBISCSI_ERR_IDBM;
  55. }
  56. fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
  57. diff --git a/usr/idbm.c b/usr/idbm.c
  58. index d5e16cb..a210c88 100644
  59. --- a/usr/idbm.c
  60. +++ b/usr/idbm.c
  61. @@ -1438,12 +1438,10 @@ int idbm_lock(void)
  62. return 0;
  63. }
  64. - if (access(LOCK_DIR, F_OK) != 0) {
  65. - if (mkdir(LOCK_DIR, 0660) != 0) {
  66. - log_error("Could not open %s: %s", LOCK_DIR,
  67. - strerror(errno));
  68. - return ISCSI_ERR_IDBM;
  69. - }
  70. + if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) ||
  71. + (access(LOCK_DIR, F_OK) != 0)) {
  72. + log_error("Could not open %s: %s", LOCK_DIR, strerror(errno));
  73. + return ISCSI_ERR_IDBM;
  74. }
  75. fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
  76. diff --git a/usr/iscsid.c b/usr/iscsid.c
  77. index 99d27ab..dbb0900 100644
  78. --- a/usr/iscsid.c
  79. +++ b/usr/iscsid.c
  80. @@ -490,8 +490,8 @@ int main(int argc, char *argv[])
  81. log_close(log_pid);
  82. exit(ISCSI_ERR);
  83. }
  84. + close(fd);
  85. }
  86. - close(fd);
  87. if ((control_fd = ipc->ctldev_open()) < 0) {
  88. log_close(log_pid);
  89. diff --git a/usr/initiator.c b/usr/initiator.c
  90. index a07f9aa..a06760c 100644
  91. --- a/usr/initiator.c
  92. +++ b/usr/initiator.c
  93. @@ -580,7 +580,7 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop,
  94. int redirected)
  95. {
  96. iscsi_session_t *session = conn->session;
  97. - uint32_t delay;
  98. + uint32_t delay = 0;
  99. log_debug(1, "re-opening session %d (reopen_cnt %d)", session->id,
  100. session->reopen_cnt);
  101. --
  102. 2.21.1