rspec/rules/S5280/cfamily/rule.adoc

21 lines
541 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
``++mktemp++``, ``++mkstemp++``, ``++mkstemps++`` or ``++mkdtemp++`` are useful functions to create temporary files and directories. They accept a ``++template++`` parameter which defines the path where the file should be created and which should contain at least six trailing "X"s to ensure the uniqueness of the filename.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
mkstemp("/tmp/file_XXXX"); // Noncompliant
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
mkstemp("/tmp/file_XXXXXX"); // Compliant
----