Changeset 13 in openpam for trunk/lib


Ignore:
Timestamp:
Feb 1, 2002, 9:35:31 PM (19 years ago)
Author:
Dag-Erling Smørgrav
Message:

Rename openpam_log() to _openpam_log(), add an argument for the
function name, and wrap it in a macro called openpam_log().

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_log.c

    r10 r13  
    3737#include <stdarg.h>
    3838#include <stdio.h>
     39#include <stdlib.h>
    3940#include <syslog.h>
    4041
     
    4849
    4950void
    50 openpam_log(int level, const char *fmt, ...)
     51_openpam_log(int level, const char *func, const char *fmt, ...)
    5152{
    5253        va_list ap;
     54        char *format;
    5355        int priority;
    5456
     
    6870        }
    6971        va_start(ap, fmt);
    70         vsyslog(priority, fmt, ap);
     72        if ((format = malloc(strlen(func) + strlen(fmt) + 8)) != NULL) {
     73                sprintf(format, "in %s(): %s", func, fmt);
     74                vsyslog(priority, format, ap);
     75                free(format);
     76        } else {
     77                vsyslog(priority, fmt, ap);
     78        }
    7179        va_end(ap);
    7280}
Note: See TracChangeset for help on using the changeset viewer.