Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package open-iscsi for openSUSE:Factory 
checked in at 2021-01-29 14:55:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/open-iscsi (Old)
 and      /work/SRC/openSUSE:Factory/.open-iscsi.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "open-iscsi"

Fri Jan 29 14:55:30 2021 rev:101 rq:867007 version:unknown

Changes:
--------
--- /work/SRC/openSUSE:Factory/open-iscsi/open-iscsi.changes    2021-01-02 
21:30:24.183400183 +0100
+++ /work/SRC/openSUSE:Factory/.open-iscsi.new.28504/open-iscsi.changes 
2021-01-29 14:55:46.809393137 +0100
@@ -1,0 +2,17 @@
+Tue Jan 26 20:03:42 UTC 2021 - Lee Duncan <ldun...@suse.com>
+
+- Update to latest upstream (no new tag yet). To fix
+  bsc#1181313. Changes since last update added to
+  open-iscsi-SUSE-latest.diff.bz2:
+  * Fix iscsiadm segfault when exiting
+  * iscsid: Add NO_SYSTEMD to CFLAGS
+  * Change mkdir permissions to 0770, adjust usmask
+  * Fix typo in util.py
+  * iscsid: Do not allow conflicting pid-file options
+  * iscsiadm: Fix memory leak in iscsiadm
+  * libopeniscsiusr: Fix memory leak in iscsi_sessions_get()
+  * libopeniscsiusr: Fix memory leak in iscsi_nodes_get()
+  * idbm: Fix memory leak and NULL pointer dereference in 
idbm_rec_update_param()
+  * Add etc/systemd/iscsi-init.service to SYSTEMDFILES Makefile variable
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ open-iscsi.spec ++++++
--- /var/tmp/diff_new_pack.EPrCG2/_old  2021-01-29 14:55:47.549394226 +0100
+++ /var/tmp/diff_new_pack.EPrCG2/_new  2021-01-29 14:55:47.553394231 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package open-iscsi
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed

++++++ open-iscsi-SUSE-latest.diff.bz2 ++++++
--- /var/tmp/diff_new_pack.EPrCG2/_old  2021-01-29 14:55:47.585394279 +0100
+++ /var/tmp/diff_new_pack.EPrCG2/_new  2021-01-29 14:55:47.593394291 +0100
@@ -0,0 +1,561 @@
+diff --git a/Makefile b/Makefile
+index c4f33889616d..4ccf706adcfd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -29,8 +29,8 @@ ETCFILES = etc/iscsid.conf
+ IFACEFILES = etc/iface.example
+ RULESFILES = utils/50-iscsi-firmware-login.rules
+ SYSTEMDFILES = etc/systemd/iscsi.service \
+-                         etc/systemd/iscsid.service etc/systemd/iscsid.socket 
\
+                          etc/systemd/iscsi-init.service \
++                         etc/systemd/iscsid.service etc/systemd/iscsid.socket 
\
+                          etc/systemd/iscsiuio.service 
etc/systemd/iscsiuio.socket
+ 
+ export DESTDIR prefix INSTALL
+diff --git a/doc/iscsid.8 b/doc/iscsid.8
+index 6f9218f74c4c..db996b410545 100644
+--- a/doc/iscsid.8
++++ b/doc/iscsid.8
+@@ -24,23 +24,28 @@ Read initiator name from \fIiname\-file\fR rather than the 
default
+ .BI [-f|--foreground]
+ run
+ .B iscsid
+-in the foreground.
++in the foreground. Implies
++.BR --no-pid-file .
+ .TP
+-.BI [-d|--debug=]\fIdebug_level\fP
++.BI [-d|--debug=] debug_level
+ print debugging information. Valid values for debug_level are 0 to 8.
+ .TP
+-.BI [-u|--uid=]\fIuid\fP
+-run under user ID \fIuid\fR (default is the current user ID)
++.BI [-u|--uid=] uid
++run under user ID \fIuid\fR (default is the current user ID).
+ .TP
+-.BI [-g|--gid=]\fIgid\fP
++.BI [-g|--gid=] gid
+ run under user group ID \fIgid\fR (default is the current user group ID).
+ .TP
+-.BI [-n|--no-pid-file]\fP
+-do not write a process ID file.
++.BI [-n|--no-pid-file]
++do not write a process ID file. Conflicts with the
++.BI --pid=
++option.
+ .TP
+-.BI [-p|--pid=]\fIpid\-file\fP
++.BI [-p|--pid=] pid\-file
+ write process ID to \fIpid\-file\fR rather than the default
+-\fI/run/iscsid.pid\fR
++\fI/run/iscsid.pid\fR. Conflicts with the 
++.BI --no-pid-file
++option. 
+ .TP
+ .BI [-h|--help]
+ display this help and exit
+diff --git a/libopeniscsiusr/context.c b/libopeniscsiusr/context.c
+index fe92155eb0a3..c5e869f498dd 100644
+--- a/libopeniscsiusr/context.c
++++ b/libopeniscsiusr/context.c
+@@ -55,8 +55,12 @@ struct iscsi_context *iscsi_context_new(void)
+ 
+ void iscsi_context_free(struct iscsi_context *ctx)
+ {
+-      if (ctx != NULL)
++      if (ctx == NULL)
++              return;
++
++      if (ctx->db)
+               _idbm_free(ctx->db);
++
+       free(ctx);
+ }
+ 
+diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
+index 060196fc7afc..0910c63ba56b 100644
+--- a/libopeniscsiusr/idbm.c
++++ b/libopeniscsiusr/idbm.c
+@@ -322,7 +322,7 @@ int _idbm_lock(struct iscsi_context *ctx)
+       }
+ 
+       if (access(LOCK_DIR, F_OK) != 0) {
+-              if (mkdir(LOCK_DIR, 0660) != 0) {
++              if (mkdir(LOCK_DIR, 0770) != 0) {
+                       _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
+                               _strerror(errno, strerr_buff));
+                       return LIBISCSI_ERR_IDBM;
+diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c
+index e7938a5e4709..4d573fb72a1c 100644
+--- a/libopeniscsiusr/iface.c
++++ b/libopeniscsiusr/iface.c
+@@ -326,7 +326,7 @@ int iscsi_default_iface_setup(struct iscsi_context *ctx)
+       _good(_idbm_lock(ctx), rc, out);
+ 
+       if ((access(IFACE_CONFIG_DIR, F_OK) != 0) &&
+-          (mkdir(IFACE_CONFIG_DIR, 0660) != 0)) {
++          (mkdir(IFACE_CONFIG_DIR, 0770) != 0)) {
+               errno_save = errno;
+               _idbm_unlock(ctx);
+               _error(ctx, "Could not make %s folder(%d %s). "
+diff --git a/libopeniscsiusr/node.c b/libopeniscsiusr/node.c
+index 6bec201df603..0bf357bf7d3d 100644
+--- a/libopeniscsiusr/node.c
++++ b/libopeniscsiusr/node.c
+@@ -109,6 +109,15 @@ int iscsi_nodes_get(struct iscsi_context *ctx, struct 
iscsi_node ***nodes,
+ 
+       _good(_scandir(ctx, NODE_CONFIG_DIR, &namelist, &n), rc, out);
+       _debug(ctx, "Got %d target from %s nodes folder", n, NODE_CONFIG_DIR);
++      /*
++       * If continue with n == 0, calloc() might return a memory which failed
++       * to be freed in iscsi_nodes_free()
++       *
++       * So here just goto out to exit if n == 0
++       */
++      if (n == 0)
++              goto out;
++
+       *node_count = n & UINT32_MAX;
+       *nodes = (struct iscsi_node **) calloc(*node_count,
+                                              sizeof(struct iscsi_node *));
+diff --git a/libopeniscsiusr/session.c b/libopeniscsiusr/session.c
+index 98601dcf807e..7ace4d6b9141 100644
+--- a/libopeniscsiusr/session.c
++++ b/libopeniscsiusr/session.c
+@@ -256,6 +256,8 @@ int iscsi_sessions_get(struct iscsi_context *ctx,
+       *session_count = 0;
+ 
+       _good(_iscsi_sids_get(ctx, &sids, session_count), rc ,out);
++      if (!*session_count)
++              goto out;
+ 
+       *sessions = calloc (*session_count, sizeof(struct iscsi_session *));
+       _alloc_null_check(ctx, *sessions, rc, out);
+diff --git a/test/harness/util.py b/test/harness/util.py
+index f6c2a3275ae5..d2a7b631a133 100644
+--- a/test/harness/util.py
++++ b/test/harness/util.py
+@@ -152,7 +152,7 @@ def new_parseArgs(self, argv):
+ 
+     # now validate stuff
+     if self.version_request:
+-        print('%s Version %s, harnes version %s' % \
++        print('%s Version %s, harness version %s' % \
+               (prog_name, parent_version, lib_version))
+         sys.exit(0)
+     Global.verbosity = self.verbosity
+@@ -176,7 +176,7 @@ def new_parseArgs(self, argv):
+         Global.partition = '%s-part1' % Global.device
+     else:
+         print('Error: must start with "/dev" or "/dev/disk/by-{id,path}": %s' 
% \
+-                Global.device, file=sys.sttderr)
++                Global.device, file=sys.stderr)
+         sys.exit(1)
+     if self.subtest_list:
+         if not user_spec_to_list(self.subtest_list):
+diff --git a/usr/Makefile b/usr/Makefile
+index 0de5e436c798..cdaf458198cf 100644
+--- a/usr/Makefile
++++ b/usr/Makefile
+@@ -44,6 +44,8 @@ ISCSI_LIB = -L$(TOPDIR)/libopeniscsiusr -lopeniscsiusr
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
+ ifeq ($(NO_SYSTEMD),)
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd)
++else
++CFLAGS += -DNO_SYSTEMD
+ endif
+ PROGRAMS = iscsid iscsiadm iscsistart
+ 
+diff --git a/usr/idbm.c b/usr/idbm.c
+index f8b50f10309c..b94b61701a13 100644
+--- a/usr/idbm.c
++++ b/usr/idbm.c
+@@ -1014,8 +1014,8 @@ int idbm_rec_update_param(recinfo_t *info, char *name, 
char *value,
+       int i;
+       int passwd_done = 0;
+       char passwd_len[8];
+-      char *tmp_value, *token;
+-      bool *found;
++      char *tmp_value, *token, *tmp;
++      bool *found = NULL;
+       int *tmp_data;
+ 
+ setup_passwd_len:
+@@ -1079,12 +1079,25 @@ setup_passwd_len:
+                               if (!info[i].data)
+                                       continue;
+                               tbl = (void *)info[i].opts[0];
+-                              /* strsep is destructive, make a copy to work 
with */
++                              /*
++                               * strsep is destructive, make a copy to work 
with
++                               * tmp_value would be modified in strsep() too, 
so
++                               * here make a copy of tmp_value to tmp
++                               */
+                               tmp_value = strdup(value);
++                              if (!tmp_value)
++                                      return ISCSI_ERR_NOMEM;
++                              tmp = tmp_value;
++
+                               k = 0;
+                               tmp_data = malloc(info[i].data_len);
++                              if (!tmp_data)
++                                      goto free_tmp;
+                               memset(tmp_data, ~0, info[i].data_len);
++
+                               found = calloc(info[i].numopts, sizeof(bool));
++                              if (!found)
++                                      goto free_tmp_data;
+ 
+ next_token:                   while ((token = strsep(&tmp_value, ", \n"))) {
+                                       if (!strlen(token))
+@@ -1113,7 +1126,7 @@ next_token:                      while ((token = 
strsep(&tmp_value, ", \n"))) {
+                                                   " for '%s'", token, 
info[i].name);
+                               }
+                               memcpy(info[i].data, tmp_data, 
info[i].data_len);
+-                              free(tmp_value);
++                              free(tmp);
+                               free(tmp_data);
+                               tmp_value = NULL;
+                               tmp_data = NULL;
+@@ -1135,8 +1148,17 @@ next_token:                     while ((token = 
strsep(&tmp_value, ", \n"))) {
+ 
+       return ISCSI_ERR_INVAL;
+ 
++free_tmp_data:
++      free(tmp_data);
++
++free_tmp:
++      free(tmp);
++      return ISCSI_ERR_NOMEM;
++
+ updated:
+       strlcpy((char*)info[i].value, value, VALUE_MAXVAL);
++      if (found)
++              free(found);
+ 
+ #define check_password_param(_param) \
+       if (!passwd_done && !strcmp(#_param, name)) { \
+@@ -1433,7 +1455,7 @@ int idbm_lock(void)
+       }
+ 
+       if (access(LOCK_DIR, F_OK) != 0) {
+-              if (mkdir(LOCK_DIR, 0660) != 0) {
++              if (mkdir(LOCK_DIR, 0770) != 0) {
+                       log_error("Could not open %s: %s", LOCK_DIR,
+                                 strerror(errno));
+                       return ISCSI_ERR_IDBM;
+@@ -2115,7 +2137,7 @@ static FILE *idbm_open_rec_w(char *portal, char *config)
+               }
+ 
+ mkdir_portal:
+-              if (mkdir(portal, 0660) != 0) {
++              if (mkdir(portal, 0770) != 0) {
+                       log_error("Could not make dir %s err %d",
+                                 portal, errno);
+                       return NULL;
+@@ -2150,7 +2172,7 @@ static int idbm_rec_write(node_rec_t *rec, bool 
disable_lock)
+ 
+       snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR);
+       if (access(portal, F_OK) != 0) {
+-              if (mkdir(portal, 0660) != 0) {
++              if (mkdir(portal, 0770) != 0) {
+                       log_error("Could not make %s: %s", portal,
+                                 strerror(errno));
+                       rc = ISCSI_ERR_IDBM;
+@@ -2160,7 +2182,7 @@ static int idbm_rec_write(node_rec_t *rec, bool 
disable_lock)
+ 
+       snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name);
+       if (access(portal, F_OK) != 0) {
+-              if (mkdir(portal, 0660) != 0) {
++              if (mkdir(portal, 0770) != 0) {
+                       log_error("Could not make %s: %s", portal,
+                                 strerror(errno));
+                       rc = ISCSI_ERR_IDBM;
+@@ -2220,7 +2242,7 @@ mkdir_portal:
+       snprintf(portal, PATH_MAX, "%s/%s/%s,%d,%d", NODE_CONFIG_DIR,
+                rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt);
+       if (stat(portal, &statb)) {
+-              if (mkdir(portal, 0660) != 0) {
++              if (mkdir(portal, 0770) != 0) {
+                       log_error("Could not make dir %s: %s",
+                                 portal, strerror(errno));
+                       rc = ISCSI_ERR_IDBM;
+@@ -2272,7 +2294,7 @@ idbm_discovery_write(discovery_rec_t *rec)
+       snprintf(portal, PATH_MAX, "%s",
+                disc_type_to_config_vals[rec->type].config_root);
+       if (access(portal, F_OK) != 0) {
+-              if (mkdir(portal, 0660) != 0) {
++              if (mkdir(portal, 0770) != 0) {
+                       log_error("Could not make %s: %s", portal,
+                                 strerror(errno));
+                       rc = ISCSI_ERR_IDBM;
+@@ -2331,7 +2353,7 @@ static int setup_disc_to_node_link(char *disc_portal, 
node_rec_t *rec)
+               break;
+       case DISCOVERY_TYPE_FW:
+               if (access(FW_CONFIG_DIR, F_OK) != 0) {
+-                      if (mkdir(FW_CONFIG_DIR, 0660) != 0) {
++                      if (mkdir(FW_CONFIG_DIR, 0770) != 0) {
+                               log_error("Could not make %s: %s",
+                                         FW_CONFIG_DIR, strerror(errno));
+                               rc = ISCSI_ERR_IDBM;
+@@ -2345,7 +2367,7 @@ static int setup_disc_to_node_link(char *disc_portal, 
node_rec_t *rec)
+               break;
+       case DISCOVERY_TYPE_STATIC:
+               if (access(STATIC_CONFIG_DIR, F_OK) != 0) {
+-                      if (mkdir(STATIC_CONFIG_DIR, 0660) != 0) {
++                      if (mkdir(STATIC_CONFIG_DIR, 0770) != 0) {
+                               log_error("Could not make %s; %s",
+                                         STATIC_CONFIG_DIR, strerror(errno));
+                               rc = ISCSI_ERR_IDBM;
+@@ -2359,7 +2381,7 @@ static int setup_disc_to_node_link(char *disc_portal, 
node_rec_t *rec)
+               break;
+       case DISCOVERY_TYPE_ISNS:
+               if (access(ISNS_CONFIG_DIR, F_OK) != 0) {
+-                      if (mkdir(ISNS_CONFIG_DIR, 0660) != 0) {
++                      if (mkdir(ISNS_CONFIG_DIR, 0770) != 0) {
+                               log_error("Could not make %s: %s",
+                                         ISNS_CONFIG_DIR, strerror(errno));
+                               rc = ISCSI_ERR_IDBM;
+@@ -3004,7 +3026,7 @@ int idbm_init(idbm_get_config_file_fn *fn)
+ {
+       /* make sure root db dir is there */
+       if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) {
+-              if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) {
++              if (mkdir(ISCSI_CONFIG_ROOT, 0770) != 0) {
+                       log_error("Could not make %s %d", ISCSI_CONFIG_ROOT,
+                                  errno);
+                       return errno;
+diff --git a/usr/iface.c b/usr/iface.c
+index 11f3d2ac8778..21d52b307191 100644
+--- a/usr/iface.c
++++ b/usr/iface.c
+@@ -551,7 +551,7 @@ void iface_setup_host_bindings(void)
+               return;
+ 
+       if (access(IFACE_CONFIG_DIR, F_OK) != 0) {
+-              if (mkdir(IFACE_CONFIG_DIR, 0660) != 0) {
++              if (mkdir(IFACE_CONFIG_DIR, 0770) != 0) {
+                       log_error("Could not make %s. HW/OFFLOAD iscsi "
+                                 "may not be supported", IFACE_CONFIG_DIR);
+                       idbm_unlock();
+diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
+index ea1643bb2586..41b7e6f25539 100644
+--- a/usr/iscsiadm.c
++++ b/usr/iscsiadm.c
+@@ -3582,11 +3582,11 @@ main(int argc, char **argv)
+       struct sigaction sa_old;
+       struct sigaction sa_new;
+       LIST_HEAD(ifaces);
+-      struct iface_rec *iface = NULL, *tmp;
++      struct iface_rec *iface = NULL, *tmp_iface;
+       struct node_rec *rec = NULL;
+       uint32_t host_no =  MAX_HOST_NO + 1;
+       uint64_t index = ULLONG_MAX;
+-      struct user_param *param;
++      struct user_param *param, *tmp_param;
+       LIST_HEAD(params);
+       struct iscsi_context *ctx = NULL;
+       int librc = LIBISCSI_OK;
+@@ -3610,7 +3610,7 @@ main(int argc, char **argv)
+       sa_new.sa_flags = 0;
+       sigaction(SIGINT, &sa_new, &sa_old );
+ 
+-      umask(0177);
++      umask(0077);
+ 
+       /* enable stdout logging */
+       log_init(program_name, 1024, log_do_log_std, NULL);
+@@ -3627,7 +3627,7 @@ main(int argc, char **argv)
+                                         "Priority must be greater than or "
+                                         "equal to zero.", killiscsid);
+                               rc = ISCSI_ERR_INVAL;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+                       break;
+               case 't':
+@@ -3639,7 +3639,7 @@ main(int argc, char **argv)
+                               log_error("can not recognize operation: '%s'",
+                                       optarg);
+                               rc = ISCSI_ERR_INVAL;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+                       break;
+               case 'n':
+@@ -3651,7 +3651,7 @@ main(int argc, char **argv)
+               case 'H':
+                       host_no = parse_host_info(optarg, &rc);
+                       if (rc)
+-                              goto free_ifaces;
++                              goto out;
+                       break;
+               case 'r':
+                       sid = iscsi_sysfs_get_sid_from_path(optarg);
+@@ -3659,7 +3659,7 @@ main(int argc, char **argv)
+                               log_error("invalid sid '%s'",
+                                         optarg);
+                               rc = ISCSI_ERR_INVAL;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+                       break;
+               case 'R':
+@@ -3710,7 +3710,7 @@ main(int argc, char **argv)
+                       mode = str_to_mode(optarg);
+                       rc = verify_mode_params(argc, argv, mode);
+                       if (ISCSI_SUCCESS != rc)
+-                              goto free_ifaces;
++                              goto out;
+                       break;
+               case 'C':
+                       sub_mode = str_to_submode(optarg);
+@@ -3739,11 +3739,11 @@ main(int argc, char **argv)
+                               printf("Invalid iface name %s. Must be from "
+                                       "1 to %d characters.\n",
+                                       optarg, ISCSI_MAX_IFACE_LEN - 1);
+-                              goto free_ifaces;
++                              goto out;
+                       } else if (!iface || rc) {
+                               printf("Could not add iface %s.", optarg);
+                               rc = ISCSI_ERR_INVAL;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+ 
+                       list_add_tail(&iface->list, &ifaces);
+@@ -3760,7 +3760,7 @@ main(int argc, char **argv)
+                               log_error("Invalid index %s. %s.",
+                                         optarg, strerror(errno));
+                               rc = ISCSI_ERR_INVAL;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+                       break;
+               case 'A':
+@@ -3778,7 +3778,7 @@ main(int argc, char **argv)
+                       if (!param) {
+                               log_error("Cannot allocate memory for params.");
+                               rc = ISCSI_ERR_NOMEM;
+-                              goto free_ifaces;
++                              goto out;
+                       }
+                       list_add_tail(&param->list, &params);
+                       name = NULL;
+@@ -3789,12 +3789,12 @@ main(int argc, char **argv)
+       if (optopt) {
+               log_error("unrecognized character '%c'", optopt);
+               rc = ISCSI_ERR_INVAL;
+-              goto free_ifaces;
++              goto out;
+       }
+ 
+       if (killiscsid >= 0) {
+               kill_iscsid(killiscsid, timeout);
+-              goto free_ifaces;
++              goto out;
+       }
+ 
+       if (mode < 0)
+@@ -3802,14 +3802,14 @@ main(int argc, char **argv)
+ 
+       if (mode == MODE_FW) {
+               rc = exec_fw_op(NULL, NULL, info_level, do_login, op);
+-              goto free_ifaces;
++              goto out;
+       }
+ 
+       increase_max_files();
+       if (idbm_init(get_config_file)) {
+               log_warning("exiting due to idbm configuration error");
+               rc = ISCSI_ERR_IDBM;
+-              goto free_ifaces;
++              goto out;
+       }
+ 
+       switch (mode) {
+@@ -4070,12 +4070,11 @@ out:
+               free(rec);
+       iscsi_sessions_free(ses, se_count);
+       idbm_terminate();
+-free_ifaces:
+-      list_for_each_entry_safe(iface, tmp, &ifaces, list) {
++      list_for_each_entry_safe(iface, tmp_iface, &ifaces, list) {
+               list_del(&iface->list);
+               free(iface);
+       }
+-      list_for_each_entry(param, &params, list) {
++      list_for_each_entry_safe(param, tmp_param, &params, list) {
+               list_del(&param->list);
+               idbm_free_user_param(param);
+       }
+diff --git a/usr/iscsid.c b/usr/iscsid.c
+index 3544870e813a..dc54fec39764 100644
+--- a/usr/iscsid.c
++++ b/usr/iscsid.c
+@@ -63,7 +63,7 @@ struct iscsi_daemon_config *dconfig = &daemon_config;
+ static char program_name[] = "iscsid";
+ static pid_t log_pid;
+ static gid_t gid;
+-static int daemonize = 1;
++static bool daemonize = true;
+ static int mgmt_ipc_fd;
+ static int sessions_to_recover = 0;
+ 
+@@ -381,6 +381,8 @@ int main(int argc, char *argv[])
+       struct sigaction sa_new;
+       int control_fd;
+       pid_t pid;
++      bool pid_file_specified = false;
++      bool no_pid_file_specified = false;
+ 
+       while ((ch = getopt_long(argc, argv, "c:i:fd:nu:g:p:vh", long_options,
+                                &longindex)) >= 0) {
+@@ -392,7 +394,7 @@ int main(int argc, char *argv[])
+                       initiatorname_file = optarg;
+                       break;
+               case 'f':
+-                      daemonize = 0;
++                      daemonize = false;
+                       break;
+               case 'd':
+                       log_level = atoi(optarg);
+@@ -405,9 +407,11 @@ int main(int argc, char *argv[])
+                       break;
+               case 'n':
+                       pid_file = NULL;
++                      no_pid_file_specified = true;
+                       break;
+               case 'p':
+                       pid_file = optarg;
++                      pid_file_specified = true;
+                       break;
+               case 'v':
+                       printf("%s version %s\n", program_name,
+@@ -422,6 +426,17 @@ int main(int argc, char *argv[])
+               }
+       }
+ 
++      if (pid_file_specified) {
++              if (no_pid_file_specified) {
++                      fprintf(stderr, "error: Conflicting PID-file options 
requested\n");
++                      usage(1);
++              }
++              if (!daemonize) {
++                      fprintf(stderr, "error: PID file specified but unused 
in foreground mode\n");
++                      usage(1);
++              }
++      }
++
+       /* initialize logger */
+       log_pid = log_init(program_name, DEFAULT_AREA_SIZE,
+                     daemonize ? log_do_log_daemon : log_do_log_std, NULL);
+@@ -442,7 +457,7 @@ int main(int argc, char *argv[])
+               exit(ISCSI_ERR);
+       }
+ 
+-      umask(0177);
++      umask(0077);
+ 
+       mgmt_ipc_fd = -1;
+       control_fd = -1;

Reply via email to