deiv commented on pull request #2235:
URL: https://github.com/apache/thrift/pull/2235#issuecomment-689625283


   > OK, so we have:
   > 
   > * pathname socket — `'\0'` is last
   > * abstract socket — `'\0'` is first
   > 
   > The `.sun_path` length is `path_.size() + 1` in both cases. This needs no 
`if`-s...
   > 
   
   * pathname socket — `'\0'` is last -> we need `path_.size() + 1`
   * abstract socket — `'\0'` is first -> we don't need `path_.size() + 1` (we 
need only `path_.size() `
   
   Take into account that, for the `memcpy(address.sun_path, path_.c_str(), 
len)` thing, we are using `c_str()' that returns an null terminated string 
   
   > I mean: the `structlen -= …` line is bad, one needs to think really hard 
to understand it completely. While the PR needs to change it anyway — why not 
improve it? The `+ 1` you're adding does fix _the issue_, but makes _the code_ 
worse.
   
   Maybe a comment could do the job ?
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to