diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-07-25 16:08:41 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-07-25 16:08:41 +0200 |
commit | 9f6993fb41a8d14111325779c14968556b4f7f83 (patch) | |
tree | 8f42ab42bc24104d17955d61940111ed2fa36033 /lib/os_mon/c_src/cpu_sup.c | |
parent | c0cb221de152593a36c4468e0f46abd0b37afae2 (diff) | |
parent | 0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb (diff) | |
download | otp-9f6993fb41a8d14111325779c14968556b4f7f83.tar.gz otp-9f6993fb41a8d14111325779c14968556b4f7f83.tar.bz2 otp-9f6993fb41a8d14111325779c14968556b4f7f83.zip |
Merge branch 'egil/change-os_mon-ports-error-messages/OTP-10161' into maint
* egil/change-os_mon-ports-error-messages/OTP-10161:
os_mon: Elucidate port program error messages
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); } |