1275
provided argument specifies the bits to enable on the specified file, the behavior of umask() is in
fact opposite: umask() sets the umask to ~mask & 0777. The documentation goes on to describe
the correct usage of umask(): "The umask is used by open() to set initial file permissions on a
newly-created file. Specifically, permissions in the umask are turned off from the mode argument
to open(2) (so, for example, the common umask default value of 022 results in new files being
created with permissions 0666 & ~022 = 0644 = rw-r--r-- in the usual case where the mode is
specified as 0666)."
CWE-561: Dead Code
Weakness ID : 561
Structure : Simple
Abstraction : Base
Description
The product contains dead code, which can never be executed.
Extended Description
Dead code is code that can never be executed in a running program. The surrounding code makes
it impossible for a section of code to ever be executed.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 1164 Irrelevant Code 1967
CanFollow 570 Expression is Always False 1292
CanFollow 571 Expression is Always True 1295
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 1006 Bad Coding Practices 2422
Weakness Ordinalities
Indirect :
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Other Quality Degradation
Dead code that results from code that can never be
executed is an indication of problems with the source code
that needs to be fixed and is an indication of poor quality.
Other Reduce Maintainability
Detection Methods
Architecture or Design Review
CWE Version 4.14
CWE-561: Dead Code
CWE-561: Dead Code