aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix/sys.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-09-04 08:10:52 +0200
committerBjörn Gustavsson <[email protected]>2011-10-09 11:33:21 +0200
commit8f4523c56f243aa4fc4ff4415f89dd1924e49d62 (patch)
tree5ccce5836be72743316146afb74c6db6785eba10 /erts/emulator/sys/unix/sys.c
parent5dcee558b61f0f5dd70e18a530a2bb97c479aab5 (diff)
downloadotp-8f4523c56f243aa4fc4ff4415f89dd1924e49d62.tar.gz
otp-8f4523c56f243aa4fc4ff4415f89dd1924e49d62.tar.bz2
otp-8f4523c56f243aa4fc4ff4415f89dd1924e49d62.zip
sys.c for Unix: Undo caching of utsname in os_flavor()
Since his function will be called only once, caching is a waste of memory.
Diffstat (limited to 'erts/emulator/sys/unix/sys.c')
-rw-r--r--erts/emulator/sys/unix/sys.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 82d2c64d81..d7f8ac60a9 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -931,18 +931,13 @@ void
os_flavor(char* namebuf, /* Where to return the name. */
unsigned size) /* Size of name buffer. */
{
- static int called = 0;
- static struct utsname uts; /* Information about the system. */
-
- if (!called) {
- char* s;
+ struct utsname uts; /* Information about the system. */
+ char* s;
- (void) uname(&uts);
- called = 1;
- for (s = uts.sysname; *s; s++) {
- if (isupper((int) *s)) {
- *s = tolower((int) *s);
- }
+ (void) uname(&uts);
+ for (s = uts.sysname; *s; s++) {
+ if (isupper((int) *s)) {
+ *s = tolower((int) *s);
}
}
strcpy(namebuf, uts.sysname);