There is no need to zero static data, and it is racy (mono/mono#15699)
authorJay Krell <jaykrell@microsoft.com>
Wed, 7 Aug 2019 14:40:57 +0000 (07:40 -0700)
committerAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 7 Aug 2019 14:40:57 +0000 (10:40 -0400)
if there are multiple threads calling (unlikely).
This zeroing was made moot by mono/mono@470354fa817716739615ff0c6cfefca42ec8b385 January 2019.

Commit migrated from https://github.com/mono/mono/commit/e8d28feb1e7a8cb0820704aee66410f4ae13c252

src/mono/mono/utils/mono-merp.c

index d3e977e..c8ba887 100644 (file)
@@ -49,7 +49,9 @@ os_version_string (void)
        static const char *version_string;
 
        if (!version_string) {
-               memset (&name, 0, sizeof (name)); // WSL does not always nul terminate.
+               // WSL does not always nul terminate. WSL was fixed February 2018.
+               // Restore memset if variable made non-static.
+               //memset (&name, 0, sizeof (name));
 
                if (uname (&name) >= 0)
                        version_string = name.release;