* [PATCH] bind_usbintf: do not reuse 'path'
@ 2016-04-07 11:20 Chunyan Liu
2016-04-07 16:52 ` Ian Jackson
0 siblings, 1 reply; 3+ messages in thread
From: Chunyan Liu @ 2016-04-07 11:20 UTC (permalink / raw)
To: xen-devel; +Cc: Simon Cao, Ian Jackson, Chunyan Liu, George Dunlap
To avoid confusion, add a new variable "intf_path" to indicate
driver/interface path, let "path" indicate driver/bind path only.
CID: 1358111
Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
tools/libxl/libxl_pvusb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
index 6447639..8cf3ddc 100644
--- a/tools/libxl/libxl_pvusb.c
+++ b/tools/libxl/libxl_pvusb.c
@@ -1035,18 +1035,18 @@ out:
static int bind_usbintf(libxl__gc *gc, const char *intf, const char *drvpath)
{
- char *path;
+ char *path, *intf_path;
struct stat st;
int fd = -1;
int rc, r;
- path = GCSPRINTF("%s/%s", drvpath, intf);
+ intf_path = GCSPRINTF("%s/%s", drvpath, intf);
/* check through lstat, if intf already exists under drvpath,
* it's already bound, return directly; if it doesn't exist,
* continue to do bind work; otherwise, return error.
*/
- r = lstat(path, &st);
+ r = lstat(intf_path, &st);
if (r == 0)
return 0;
if (r < 0 && errno != ENOENT)
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bind_usbintf: do not reuse 'path'
2016-04-07 11:20 [PATCH] bind_usbintf: do not reuse 'path' Chunyan Liu
@ 2016-04-07 16:52 ` Ian Jackson
2016-04-08 4:13 ` Chun Yan Liu
0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2016-04-07 16:52 UTC (permalink / raw)
To: Chunyan Liu; +Cc: Simon Cao, George Dunlap, xen-devel
Chunyan Liu writes ("[PATCH] bind_usbintf: do not reuse 'path'"):
> To avoid confusion, add a new variable "intf_path" to indicate
> driver/interface path, let "path" indicate driver/bind path only.
I think it would be better to rename both variables, as I suggested in
my mail yesterday. That makes it much more obvious that each place
where `path' was used has been checked and the reference to the
proper variable substituted.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bind_usbintf: do not reuse 'path'
2016-04-07 16:52 ` Ian Jackson
@ 2016-04-08 4:13 ` Chun Yan Liu
0 siblings, 0 replies; 3+ messages in thread
From: Chun Yan Liu @ 2016-04-08 4:13 UTC (permalink / raw)
To: Ian Jackson; +Cc: Simon Cao, George Dunlap, xen-devel
>>> On 4/8/2016 at 12:52 AM, in message
<22278.36941.470901.631613@mariner.uk.xensource.com>, Ian Jackson
<Ian.Jackson@eu.citrix.com> wrote:
> Chunyan Liu writes ("[PATCH] bind_usbintf: do not reuse 'path'"):
> > To avoid confusion, add a new variable "intf_path" to indicate
> > driver/interface path, let "path" indicate driver/bind path only.
>
> I think it would be better to rename both variables, as I suggested in
> my mail yesterday. That makes it much more obvious that each place
> where `path' was used has been checked and the reference to the
> proper variable substituted.
Updated. Sent V2.
>
> Thanks,
> Ian.
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-08 4:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-07 11:20 [PATCH] bind_usbintf: do not reuse 'path' Chunyan Liu
2016-04-07 16:52 ` Ian Jackson
2016-04-08 4:13 ` Chun Yan Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).