<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 01/31/2015 10:49 PM, Dennis
Schafroth wrote:<br>
</div>
<blockquote
cite="mid:F42EB6EB-0A7C-421D-8CA7-3A16D6AB3904@schafroth.dk"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div class="">Hi </div>
<div class=""><br class="">
</div>
<div class="">when compiling dht-common.c with clang (on mac, but
I dont think that matters) some warnings seem to reveal an
error:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> CC dht-common.lo</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><b class="">dht-common.c:2997:57: </b><span
style="font-variant-ligatures: no-common-ligatures; color:
#ff40ff" class=""><b class="">warning: </b></span><b
class="">size argument in 'strncmp' call is a comparison
[-Wmemsize-comparison]</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> strlen
(GF_XATTR_LOCKINFO_KEY) != 0))) {</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(45, 230, 33);" class=""><b class="">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><b class="">dht-common.c:2996:17: </b><span
style="font-variant-ligatures: no-common-ligatures; color:
#828282" class=""><b class="">note: </b></span>did you mean
to compare the result of 'strncmp' instead?</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> && (strncmp (key,
GF_XATTR_LOCKINFO_KEY,</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(45, 230, 33);" class=""><b class="">
^</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><b class="">dht-common.c:2997:26: </b><span
style="font-variant-ligatures: no-common-ligatures; color:
#828282" class=""><b class="">note: </b></span>explicitly
cast the argument to size_t to silence this warning</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> strlen
(GF_XATTR_LOCKINFO_KEY) != 0))) {</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(45, 230, 33);" class=""><b class="">
^</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(52, 189, 38);" class="">
(size_t)( )</div>
</div>
<div class=""><br class="">
</div>
<div class="">I believe that the a parentes is misplaced, so the
code is doing </div>
<div class=""><br class="">
</div>
<div class="">strncmp(key, <span style="font-family: Menlo;
font-size: 14px;" class="">GF_XATTR_LOCKINFO_KEY, 0) </span></div>
<div class=""><br class="">
</div>
<div class="">I think the following patch moves the paretens the
correct place:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><b class="">---
a/xlators/cluster/dht/src/dht-common.c</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><b class="">+++
b/xlators/cluster/dht/src/dht-common.c</b></div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""><span style="font-variant-ligatures:
no-common-ligatures; color: #34bbc7" class="">@@ -2994,7
+2994,7 @@</span> dht_fgetxattr (call_frame_t *frame,
xlator_t *this,</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> if ((fd->inode->ia_type == IA_IFDIR)</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> && key</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> && (strncmp (key,
GF_XATTR_LOCKINFO_KEY,</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(195, 55, 32);" class="">-
strlen (GF_XATTR_LOCKINFO_KEY) != 0))) {</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;
color: rgb(52, 189, 38);" class="">+
strlen (GF_XATTR_LOCKINFO_KEY)) != 0)) {</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> cnt = local->call_cnt =
layout->cnt;</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> } else {</div>
<div style="margin: 0px; font-size: 14px; font-family: Menlo;"
class=""> cnt = local->call_cnt = 1;</div>
</div>
</blockquote>
Thanks for submitting the patch. Gave +1 already. One of the
maintainers of dht will pick it up.<br>
<br>
Pranith<br>
<blockquote
cite="mid:F42EB6EB-0A7C-421D-8CA7-3A16D6AB3904@schafroth.dk"
type="cite">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">cheers, </div>
<div class="">:-Dennis </div>
<div class=""><br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Gluster-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>
<a class="moz-txt-link-freetext" href="http://www.gluster.org/mailman/listinfo/gluster-devel">http://www.gluster.org/mailman/listinfo/gluster-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>