diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-07-24 17:03:01 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-07-24 17:14:16 +0200 |
commit | 0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb (patch) | |
tree | 36721a788d0b7d985634042e88deb2f79f232047 /lib/os_mon/c_src/cpu_sup.c | |
parent | 92eb89bd630e822cfc93a07dad7d6c7a25f45d63 (diff) | |
download | otp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.tar.gz otp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.tar.bz2 otp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.zip |
os_mon: Elucidate port program error messages
Try to avoid confusion of the message 'Erlang has closed' by
clarifying that the message is sent from os_mon port programs.
Diffstat (limited to 'lib/os_mon/c_src/cpu_sup.c')
-rw-r--r-- | lib/os_mon/c_src/cpu_sup.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/os_mon/c_src/cpu_sup.c b/lib/os_mon/c_src/cpu_sup.c index 9c5f9a6aa5..a0432b3093 100644 --- a/lib/os_mon/c_src/cpu_sup.c +++ b/lib/os_mon/c_src/cpu_sup.c @@ -458,8 +458,18 @@ static void error(char* err_msg) { * if we get error here we have trouble, * silence unnecessary warnings */ - if(write(FD_ERR, err_msg, strlen(err_msg))); - if(write(FD_ERR, "\n", 1)); + char buffer[256] = "[os_mon] cpu supervisor port (cpu_sup): "; + int i = strlen(buffer), j = 0; + int n = strlen(err_msg); + + while(i < 253 && j < n) { + buffer[i++] = err_msg[j++]; + } + buffer[i++] = '\r'; + buffer[i++] = '\n'; + + /* try to use one write only */ + if(write(FD_ERR, buffer, i)); exit(-1); } |