Ignore:
Timestamp:
26/07/06 11:18:55 (13 years ago)
Author:
spascoe
Message:

I've created a bbftpd log facility to replace syslog.
At present it allows you to log messages to a file in addition
to syslog. This should help testing on other machines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/createreceivesock.c

    r773 r1328  
    5555#include <netinet/in.h> 
    5656#include <netinet/tcp.h> 
    57 #include <syslog.h> 
     57#include <bbftpd_log.h> 
    5858#include <sys/socket.h> 
    5959#include <sys/types.h> 
     
    8484    sock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ; 
    8585    if ( sock < 0 ) { 
    86         syslog(BBFTPD_ERR, "Cannot create receive socket %d : %s",socknum,strerror(errno)); 
     86        bbftpd_log(BBFTPD_ERR, "Cannot create receive socket %d : %s",socknum,strerror(errno)); 
    8787        sprintf(logmessage,"Cannot create receive socket %d : %s",socknum,strerror(errno)) ; 
    8888        return (-1) ; 
     
    9090    if ( setsockopt(sock,SOL_SOCKET, SO_REUSEADDR,(char *)&on,sizeof(on)) < 0 ) { 
    9191        close(sock) ; 
    92         syslog(BBFTPD_ERR,"Cannot set SO_REUSEADDR on receive socket %d : %s",socknum,strerror(errno)) ; 
     92        bbftpd_log(BBFTPD_ERR,"Cannot set SO_REUSEADDR on receive socket %d : %s",socknum,strerror(errno)) ; 
    9393        sprintf(logmessage,"Cannot set SO_REUSEADDR on receive socket %d : %s",socknum,strerror(errno)) ; 
    9494        return (-1) ; 
     
    9696    if ( setsockopt(sock,SOL_SOCKET, SO_RCVBUF,(char *)&tcpwinsize,sizeof(tcpwinsize)) < 0 ) { 
    9797        close(sock) ; 
    98         syslog(BBFTPD_ERR,"Cannot set SO_RCVBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
     98        bbftpd_log(BBFTPD_ERR,"Cannot set SO_RCVBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
    9999        sprintf(logmessage,"Cannot set SO_RCVBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
    100100        return (-1) ; 
     
    102102    if ( setsockopt(sock,SOL_SOCKET, SO_SNDBUF,(char *)&tcpwinsize,sizeof(tcpwinsize)) < 0 ) { 
    103103        close(sock) ; 
    104         syslog(BBFTPD_ERR,"Cannot set SO_SNDBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
     104        bbftpd_log(BBFTPD_ERR,"Cannot set SO_SNDBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
    105105        sprintf(logmessage,"Cannot set SO_SNDBUF on receive socket %d : %s",socknum,strerror(errno)) ; 
    106106        return (-1) ; 
     
    108108    if ( setsockopt(sock,IPPROTO_TCP, TCP_NODELAY,(char *)&on,sizeof(on)) < 0 ) { 
    109109        close(sock) ; 
    110         syslog(BBFTPD_ERR,"Cannot set TCP_NODELAY on receive socket %d : %s",socknum,strerror(errno)) ; 
     110        bbftpd_log(BBFTPD_ERR,"Cannot set TCP_NODELAY on receive socket %d : %s",socknum,strerror(errno)) ; 
    111111        sprintf(logmessage,"Cannot set TCP_NODELAY on receive socket %d : %s",socknum,strerror(errno)) ; 
    112112        return (-1) ; 
     
    125125    if ( bind(sock, (struct sockaddr *) &data_source,sizeof(data_source)) < 0) { 
    126126        close(sock) ; 
    127         syslog(BBFTPD_ERR,"Cannot bind on receive socket %d : %s",socknum,strerror(errno)) ; 
     127        bbftpd_log(BBFTPD_ERR,"Cannot bind on receive socket %d : %s",socknum,strerror(errno)) ; 
    128128        sprintf(logmessage,"Cannot bind on receive socket %d : %s",socknum,strerror(errno)) ; 
    129129        return (-1) ; 
     
    141141            */ 
    142142            close(sock) ; 
    143             syslog(BBFTPD_ERR,"Cannot connect receive socket %d : %s, telling calling to retry ",socknum,strerror(errno)) ; 
     143            bbftpd_log(BBFTPD_ERR,"Cannot connect receive socket %d : %s, telling calling to retry ",socknum,strerror(errno)) ; 
    144144            return 0 ; 
    145145        } else { 
    146146            close(sock) ; 
    147             syslog(BBFTPD_ERR,"Cannot connect receive socket %d : %s",socknum,strerror(errno)) ; 
     147            bbftpd_log(BBFTPD_ERR,"Cannot connect receive socket %d : %s",socknum,strerror(errno)) ; 
    148148            sprintf(logmessage,"Cannot connect receive socket %d : %s",socknum,strerror(errno)) ; 
    149149            return (-1) ; 
Note: See TracChangeset for help on using the changeset viewer.