Menu

#13 | and || mixup ?

v1.0 (example)
open
nobody
None
5
2016-09-06
2016-09-06
dcb
No

modechange.c:347]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.

Source code is

  /* Affect the execute bits if execute bits are already set
     or if the file is a directory.  */
  if ((newmode & (S_IXUSR | S_IXGRP | S_IXOTH)) | dir)
    value |= S_IXUSR | S_IXGRP | S_IXOTH;

Maybe better code

  /* Affect the execute bits if execute bits are already set
     or if the file is a directory.  */
  if ((newmode & (S_IXUSR | S_IXGRP | S_IXOTH)) || dir)
    value |= S_IXUSR | S_IXGRP | S_IXOTH;

Discussion

MongoDB Logo MongoDB