Bug 201286 - tools/regression/security/open_to_operation/open_to_operation.c:172: bad if test ?
Summary: tools/regression/security/open_to_operation/open_to_operation.c:172: bad if t...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-testing (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 16:23 UTC by David Binderman
Modified: 2015-11-09 09:44 UTC (History)
2 users (show)

See Also:
ngie: mfc-stable10+
ngie: mfc-stable9+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2015-07-02 16:23:38 UTC
tools/regression/security/open_to_operation/open_to_operation.c:172]: (style) Same expression on both sides of '=='.

       if (expected_errno && expected_errno == expected_errno)
            ok_mode(testname, NULL, mode);
        else if (expected_errno)

Even if the pointless comparison is removed, then the first
if and the second if are the same, so that needs rework too.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2015-07-02 17:46:51 UTC
Probably "errno == expected_errno" was intended
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-10-30 10:09:46 UTC
A commit references this bug:

Author: ngie
Date: Fri Oct 30 10:09:04 UTC 2015
New revision: 290190
URL: https://svnweb.freebsd.org/changeset/base/290190

Log:
  Fix compiler warnings with open_to_operation.c

  Other sidenotes:
  - Remove unused variables with main(..)
  - Convert errx/exit with -1 to errx/exit with 1
  - Fix a bogus test in try_directory_open
    (expected_errno == expected_errno -> errno == expected_errno) [*]
  - Fix some warnings related to discarded qualifiers
  - Remove a bogus else-statement at the end of check_mmap_exec(..) in the
    successful case. mmap(2), POSIX, Linux, etc all don't state what the
    behavior is when mixing O_WRONLY + PROT_EXEC, so assume success for now to
    get the test program to pass again.

  PR: 201286 [*]
  MFC after: 1 week
  Submitted by: David Binderman <dcb314@hotmail.com>
  Sponsored by: EMC / Isilon Storage Division

Changes:
  head/tools/regression/security/open_to_operation/Makefile
  head/tools/regression/security/open_to_operation/open_to_operation.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-11-09 07:26:52 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 07:26:34 UTC 2015
New revision: 290580
URL: https://svnweb.freebsd.org/changeset/base/290580

Log:
  MFC r290190,r290251:

  r290190:

  Fix compiler warnings with open_to_operation.c

  Other sidenotes:
  - Remove unused variables with main(..)
  - Convert errx/exit with -1 to errx/exit with 1
  - Fix a bogus test in try_directory_open
    (expected_errno == expected_errno -> errno == expected_errno) [*]
  - Fix some warnings related to discarded qualifiers
  - Remove a bogus else-statement at the end of check_mmap_exec(..) in the
    successful case. mmap(2), POSIX, Linux, etc all don't state what the
    behavior is when mixing O_WRONLY + PROT_EXEC, so assume success for now to
    get the test program to pass again.

  PR: 201286 [*]
  Submitted by: David Binderman <dcb314@hotmail.com>
  Sponsored by: EMC / Isilon Storage Division

  r290251:

  Use nitems(x) instead of sizeof(x)/sizeof(x[0])

  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/10/
  stable/10/tools/regression/security/open_to_operation/Makefile
  stable/10/tools/regression/security/open_to_operation/open_to_operation.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-11-09 07:28:54 UTC
A commit references this bug:

Author: ngie
Date: Mon Nov  9 07:28:17 UTC 2015
New revision: 290581
URL: https://svnweb.freebsd.org/changeset/base/290581

Log:
  MFstable/10 r290580:

  MFC r290190,r290251:

  r290190:

  Fix compiler warnings with open_to_operation.c

  Other sidenotes:
  - Remove unused variables with main(..)
  - Convert errx/exit with -1 to errx/exit with 1
  - Fix a bogus test in try_directory_open
    (expected_errno == expected_errno -> errno == expected_errno) [*]
  - Fix some warnings related to discarded qualifiers
  - Remove a bogus else-statement at the end of check_mmap_exec(..) in the
    successful case. mmap(2), POSIX, Linux, etc all don't state what the
    behavior is when mixing O_WRONLY + PROT_EXEC, so assume success for now to
    get the test program to pass again.

  PR: 201286 [*]
  Submitted by: David Binderman <dcb314@hotmail.com>
  Sponsored by: EMC / Isilon Storage Division

  r290251:

  Use nitems(x) instead of sizeof(x)/sizeof(x[0])

  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/9/
_U  stable/9/tools/
_U  stable/9/tools/regression/
  stable/9/tools/regression/security/open_to_operation/Makefile
  stable/9/tools/regression/security/open_to_operation/open_to_operation.c