]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - ip2name_exec.c
Generate redirector log even if -d is not given
[thirdparty/sarg.git] / ip2name_exec.c
index 71bbd61bd8656bb7a87e510bfa756be92187e1cb..11962d4936ffa55bfd63ae4318a7b328cb424195 100644 (file)
@@ -58,7 +58,7 @@ static void ip2name_execconfig(const char *name,const char *param)
 
        len=strlen(param);
        if (len>=sizeof(ExecCmd)) {
-               debuga(_("Command to execute to resolve the IP addresses is too long (maximum is %d bytes)\n"),(int)sizeof(ExecCmd));
+               debuga(__FILE__,__LINE__,_("Command to execute to resolve the IP addresses is too long (maximum is %d bytes)\n"),(int)sizeof(ExecCmd));
                exit(EXIT_FAILURE);
        }
        strcpy(ExecCmd,param);
@@ -83,7 +83,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
        size_t nread;
 
        if (ExecCmd[0]=='\0') {
-               debuga(_("No command to run to resolve an IP address. Please configure it in sarg.conf\n"));
+               debuga(__FILE__,__LINE__,_("No command to run to resolve an IP address. Please configure it in sarg.conf\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -92,7 +92,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
        for (i=0 ; i<sizeof(ExecCmd) && ExecCmd[i] ; i++) {
                if (ExecCmd[i]=='%' && strncmp(ExecCmd+i+1,"IP",2)==0) {
                        if (j+len>=sizeof(cmd)) {
-                               debuga(_("IP address \"%s\" too long for the command to run\n"),ip);
+                               debuga(__FILE__,__LINE__,_("IP address \"%s\" too long for the command to run\n"),ip);
                                return(INRC_Error);
                        }
                        strcpy(cmd+j,ip);
@@ -100,7 +100,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
                        i+=2;
                } else {
                        if (j>=sizeof(cmd)) {
-                               debuga(_("IP address \"%.*s\" too long for the command to run\n"),ip_len,ip);
+                               debuga(__FILE__,__LINE__,_("IP address \"%s\" too long for the command to run\n"),ip);
                                return(INRC_Error);
                        }
                        cmd[j++]=ExecCmd[i];
@@ -110,14 +110,14 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
 
        cmd_in=popen(cmd,"r");
        if (!cmd_in) {
-               debuga(_("Cannot run command %s\n"),cmd);
+               debuga(__FILE__,__LINE__,_("Cannot run command %s\n"),cmd);
                exit(EXIT_FAILURE);
        }
 
        nread=fread(buffer,1,sizeof(buffer),cmd_in);
 
        if (pclose(cmd_in)==-1) {
-               debuga(_("Command failed: %s\n"),cmd);
+               debuga(__FILE__,__LINE__,_("Command failed: %s\n"),cmd);
                exit(EXIT_FAILURE);
        }