On Thursday, November 14, 2013 11:09:37 PM UTC-8, Uli wrote:
>
> >>> <mich...@cs.wisc.edu <javascript:>> schrieb am 15.11.2013 um 00:53 in 
> Nachricht 
> <1384473233-4711-1-git-send-email-micha...@cs.wisc.edu <javascript:>>: 
> > From: Yufei Ren <yufe...@stonybrook.edu <javascript:>> 
> > 
> > Got "can not connect to iSCSI daemon (111)!" error during 
> > starting iscsi service by: 
> > $ iscsiadm -m node --loginall=all 
> > 
> > Traced down and found that the sun_path was mis-used in both iscsid 
> > and iscsiadm. 
> > --- 
> >  usr/iscsid_req.c |    2 +- 
> >  usr/mgmt_ipc.c   |    2 +- 
> >  2 files changed, 2 insertions(+), 2 deletions(-) 
> > 
> > diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c 
> > index 715c0aa..0ebde90 100644 
> > --- a/usr/iscsid_req.c 
> > +++ b/usr/iscsid_req.c 
> > @@ -71,7 +71,7 @@ static int ipc_connect(int *fd, char *unix_sock_name, 
> int 
> > start_iscsid) 
> >   
> >          memset(&addr, 0, sizeof(addr)); 
> >          addr.sun_family = AF_LOCAL; 
> > -        memcpy((char *) &addr.sun_path + 1, unix_sock_name, 
> > +        memcpy((char *) addr.sun_path + 1, unix_sock_name, 
> >                 strlen(unix_sock_name)); 
>
> A note on style: If you do a memcpy() with strlen() as length argument, 
> why not use plain strcpy()? It's even more efficient... 
>

[Almost] Never do a strcpy(). Always use strncpy() unless you have 
unlimited space, or you know for certain how long the source string is 
already.
 

>
> >   
> >          /* 
> > diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c 
> > index 87bd346..6a422b9 100644 
> > --- a/usr/mgmt_ipc.c 
> > +++ b/usr/mgmt_ipc.c 
> > @@ -63,7 +63,7 @@ mgmt_ipc_listen(void) 
> >   
> >          memset(&addr, 0, sizeof(addr)); 
> >          addr.sun_family = AF_LOCAL; 
> > -        memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, 
> addr_len); 
> > +        memcpy((char *) addr.sun_path + 1, ISCSIADM_NAMESPACE, 
> addr_len); 
> >   
> >          if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) 
> { 
> >                  log_error("Can not bind IPC socket"); 
> > -- 
> > 1.7.1 
> > 
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to