#763 closed defect (fixed)
psError() should strip trailing newline from error strings
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | sys | Version: | 0.11.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
There's lots of code that has \n at the end of its error strings. This makes the traceback
from psErrorStackPrint() harder to read. While we could fix all the user code, it's much
simpler to make p_psError simply strip a single \n at the end of the format. Here's a
patch
* src/sys/psError.c Wed May 24 15:26:56 2006
--- src/sys/psError.c.~1.28.~ Thu Jul 14 22:33:54 2005
*
* 90,101
va_start(argPtr, format);
vsnprintf(errMsg,2048,format,argPtr);
- Remove a single trailing \n from message -- it interferes with psErrorStackPrint
- int len = strlen(errMsg);
- if (len > 0 && errMsg[len - 1] == '\n') {
- errMsg[len - 1] = '\0'; len--;
- }
err = psErrAlloc(msgName,code,errMsg);
pushErrorStack(err);
--- 90,95 ----
Note:
See TracTickets
for help on using tickets.

I've applied the patch.
BTW, it was generated around the wrong way:
price@mithrandir:/home/mithrandir/price/mhpcc/psLib_rel11>patch -p0 <
~/rhl_psError.patch
patching file src/sys/psError.c
Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/sys/psError.c.rej
price@mithrandir:/home/mithrandir/price/mhpcc/psLib_rel11>patch -p0 -R <
~/rhl_psError.patch
patching file src/sys/psError.c