Repository: dotnet/runtime
File: src/coreclr/pal/src/thread/process.cpp (C++)

Code before:
}
#else
VOID
PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, void* context, bool serialize)
{
    // Preserve context pointer to prevent optimization
    DoNotOptimize(&context);

    // If enabled, launch the create minidump utility and wait until it completes
    if (g_argvCreateDump[0] != nullptr)
    {
        const char* argv[MAX_ARGV_ENTRIES];
        char* signalArg = nullptr;
        char* crashThreadArg = nullptr;
        char* signalCodeArg = nullptr;
        char* signalErrnoArg = nullptr;
        char* signalAddressArg = nullptr;

        // Copy the createdump argv
        int argc = 0;
        for (; argc < MAX_ARGV_ENTRIES && g_argvCreateDump[argc] != nullptr; argc++)
        {
            argv[argc] = g_argvCreateDump[argc];
        }

        if (signal != 0 && argc < MAX_ARGV_ENTRIES)
        {
            // Add the signal number to the command line
            signalArg = PROCFormatInt(signal);
            if (signalArg != nullptr)
            {
                argv[argc++] = "--signal";
                argv[argc++] = signalArg;
            }

            // Add the current thread id to the command line. This function is always called on the crashing thread.
            crashThreadArg = PROCFormatInt(THREADSilentGetCurrentThreadId());
            if (crashThreadArg != nullptr)
            {
                argv[argc++] = "--crashthread";
                argv[argc++] = crashThreadArg;
            }

            if (siginfo != nullptr && argc < MAX_ARGV_ENTRIES)
            {
                signalCodeArg = PROCFormatInt(siginfo->si_code);
                if (signalCodeArg != nullptr)
                {
                    argv[argc++] = "--code";
                    argv[argc++] = signalCodeArg;
                }

Review comment (suggestion):
```suggestion
        if (signal != 0)
```
Unnecessary

Code after:
}
#else
VOID
PROCCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, void* context, bool serialize)
{
    // Preserve context pointer to prevent optimization
    DoNotOptimize(&context);

    // If enabled, launch the create minidump utility and wait until it completes
    if (g_argvCreateDump[0] != nullptr)
    {
        const char* argv[MAX_ARGV_ENTRIES];
        char* signalArg = nullptr;
        char* crashThreadArg = nullptr;
        char* signalCodeArg = nullptr;
        char* signalErrnoArg = nullptr;
        char* signalAddressArg = nullptr;

        // Copy the createdump argv
        int argc = 0;
        for (; argc < MAX_ARGV_ENTRIES && g_argvCreateDump[argc] != nullptr; argc++)
        {
            argv[argc] = g_argvCreateDump[argc];
        }

        if (signal != 0)
        {
            // Add the signal number to the command line
            signalArg = PROCFormatInt(signal);
            if (signalArg != nullptr)
            {
                argv[argc++] = "--signal";
                argv[argc++] = signalArg;
            }

            // Add the current thread id to the command line. This function is always called on the crashing thread.
            crashThreadArg = PROCFormatInt(THREADSilentGetCurrentThreadId());
            if (crashThreadArg != nullptr)
            {
                argv[argc++] = "--crashthread";
                argv[argc++] = crashThreadArg;
            }

            if (siginfo != nullptr)
            {
                signalCodeArg = PROCFormatInt(siginfo->si_code);
                if (signalCodeArg != nullptr)
                {
                    argv[argc++] = "--code";
                    argv[argc++] = signalCodeArg;
                }