Avoiding Common Errors

Incorrect buffer sizes and incorrect input parameters often cause software flaws in applications that call Advanced Server API functions.

Advanced Server header files define symbolic constants for bit values, mask values, and return codes. You should always use these defined constants instead of hard-coded numeric values. The use of symbolic constants makes an application program easier to debug and maintain.

Protection Violations and Faults

The standard UNIX system programming rules apply regarding invalid addresses. Passing invalid addresses to functions will probably result in a core dump that can be examined with the Symbolic Debugger (sdb) program provided with your C compiler. If a fault occurs within an Advanced Server dynamic-link library, check the values of the parameters passed to the API function.

The API functions probe the buffers passed to them and scan string parameters to ensure that the data is accessible. These probes may cause faults if the pointers are bad (that is, point beyond the end of a segment or outside a permitted memory region).

If you get a fault within an Advanced Server dynamic-link library, attempt to trace the code through the call. By noting which values are being tested, you can usually recognize which parameter is causing the problem. Carefully check buffer sizes, since the API functions probe the first and last byte of a buffer even if the data returned or received do not fill the buffer.

Previous Page Page Top Index Next Page See Page