]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Fix a compile error on 64-bit processors
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 31 Mar 2014 18:40:19 +0000 (20:40 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Mon, 31 Mar 2014 18:40:19 +0000 (20:40 +0200)
A long long int must be cast to a int64_t before being formatted to a
PRIi64 in a printf-like function.

log.c

diff --git a/log.c b/log.c
index c2a13a1b4ba16642d578deac0ddb509611830295..de08ac880bafaef41976c71ccfae0275a852542c 100644 (file)
--- a/log.c
+++ b/log.c
@@ -1503,14 +1503,14 @@ int main(int argc,char *argv[])
                                }
                        }
 
-                       if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%"PRIi64"\t%s\t%ld\t%s\n",dia,hora,ip,url,nbytes,code,elap_time,smartfilter)<=0) {
+                       if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%"PRIi64"\t%s\t%ld\t%s\n",dia,hora,ip,url,(int64_t)nbytes,code,elap_time,smartfilter)<=0) {
                                debuga(_("Write error in the log file of user %s\n"),user);
                                exit(EXIT_FAILURE);
                        }
                        records_kept++;
 
                        if(fp_log && ilf!=ILF_Sarg)
-                               fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%"PRIi64"\t%s\t%ld\t%s\n",dia,hora,user,ip,url,nbytes,code,elap_time,smartfilter);
+                               fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%"PRIi64"\t%s\t%ld\t%s\n",dia,hora,user,ip,url,(int64_t)nbytes,code,elap_time,smartfilter);
 
                        totregsg++;
 
@@ -1561,7 +1561,7 @@ int main(int argc,char *argv[])
                                printf("FUNC=\t%s\n",fun);
                                printf("URL=\t%s\n",url);
                                printf("CODE=\t%s\n",code);
-                               printf("LEN=\t%"PRIi64"\n",nbytes);
+                               printf("LEN=\t%"PRIi64"\n",(int64_t)nbytes);
                        }
                }
                if (!from_stdin) {