Changeset 93

Show
Ignore:
Timestamp:
07/03/05 04:54:55 (4 years ago)
Author:
jtv
Message:

New function log_perrno_str()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/log.c

    r79 r93  
    105105 
    106106 
    107 void log_perr_str(int priority, const char msg[], const char arg[]
     107void log_perrno_str(int priority, const char msg[], const char arg[], int err
    108108{ 
    109   const int fault_errno = errno; 
    110   if (!fault_errno) 
     109  if (!err) 
    111110  { 
    112111    log_str(priority, msg, arg); 
     
    114113  else 
    115114  { 
    116     const char *std = strerror(fault_errno); 
     115    const char *std = strerror(err); 
    117116    if (logging) 
    118117      syslog(priority, "%s '%s': %s", msg, arg, std); 
     
    120119      fprintf(stream(priority),"%s%s '%s': %s\n",prefix(priority),msg,arg,std); 
    121120  } 
     121} 
     122 
     123 
     124void log_perr_str(int priority, const char msg[], const char arg[]) 
     125{ 
     126  log_perrno_str(priority, msg, arg, errno); 
    122127} 
    123128 
  • src/log.h

    r76 r93  
    4545void log_perr_str(int priority, const char msg[], const char arg[]); 
    4646 
     47/// Log message, perror()-style, but appending a quoted string 
     48void log_perrno_str(int priority, const char msg[], const char arg[], int err); 
     49 
    4750/// Log message, but appending an integer argument 
    4851void log_int(int priority, const char msg[], int arg);