summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-04-15 10:03:05 +0900
committerMichele Calgaro <[email protected]>2024-04-16 17:23:20 +0900
commitb7cd64b9220f245bcea522dca8e202bf9819529c (patch)
treeb010681362c4900fcd1ccbf28d788637b9d4f5ab
parent891c41833121030e071b0d1f3a7d7d916e9d0293 (diff)
downloadklamav-b7cd64b9220f245bcea522dca8e202bf9819529c.tar.gz
klamav-b7cd64b9220f245bcea522dca8e202bf9819529c.zip
Fix FTBFS causes by invalid casts. This resolves issue 37.r14.1.2
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit 74b0e9077b3c7d56cfcedcbf0fd30dd9d2ab7d01)
-rwxr-xr-xsrc/klammail/clamdmail.c18
-rwxr-xr-xsrc/klammail/client.c11
-rwxr-xr-xsrc/klammail/options.c3
3 files changed, 19 insertions, 13 deletions
diff --git a/src/klammail/clamdmail.c b/src/klammail/clamdmail.c
index 287de48..c9694d7 100755
--- a/src/klammail/clamdmail.c
+++ b/src/klammail/clamdmail.c
@@ -35,9 +35,10 @@
#include <pwd.h>
#include <clamav.h>
-#include "options.h"
#include "defaults.h"
#include "memory.h"
+#include "options.h"
+#include "output.h"
#include "../version.h"
#include "../../config.h"
@@ -75,6 +76,10 @@ struct s_info claminfo;
short printinfected = 0;
/* short int mprintf_stdout; */
+extern int client(const char *dirname, struct optstruct *opt, const char **virname);
+
+int spoolstdin(char *tmpnm, int fd, int ret, const char **virname, const char **bndrystore, struct optstruct *opt);
+
int clamdscan(struct optstruct *opt)
{
int ds, dms;
@@ -94,7 +99,8 @@ int clamdscan(struct optstruct *opt)
char buff[BUFFSIZE];
struct cl_node *trie = NULL;
int threads = 0;
- int fd, fdtmp, ret, no = 0;
+ int fd, fdtmp, ret;
+ unsigned int no = 0;
unsigned long int size = 0;
long double mb;
const char *virname;
@@ -175,7 +181,7 @@ int clamdscan(struct optstruct *opt)
/* Clamd isn't running, scan the file ourselves */
- if((ret == 2)) {
+ if(ret == 2) {
/* Clamd isn't running, start it so it is available next time. */
startclamd(opt);
@@ -220,7 +226,7 @@ int clamdscan(struct optstruct *opt)
options.general |= CL_SCAN_GENERAL_HEURISTICS;
options.mail |= CL_SCAN_MAIL_PARTIAL_MESSAGE;
ret = cl_scandesc(fd, tmpnm, &virname, &size, engine, &options );
- printf("scandesc returned: %i\n", cl_strerror(ret));
+ printf("scandesc returned: %s\n", cl_strerror(ret));
if( ret == CL_VIRUS )
printf("virus found\n");
else
@@ -233,7 +239,7 @@ int clamdscan(struct optstruct *opt)
spoolstdin(tmpnm, fd, ret, &virname, &bndrystore, opt);
- if((ret == 2))
+ if(ret == 2)
cl_engine_free(engine);
unlink(tmpnm);
@@ -241,7 +247,7 @@ int clamdscan(struct optstruct *opt)
mexit(0);
}
-int spoolstdin(char *tmpnm, int fd, int ret, char **virname, const char **bndrystore, struct optstruct *opt)
+int spoolstdin(char *tmpnm, int fd, int ret, const char **virname, const char **bndrystore, struct optstruct *opt)
{
int bytes;
int i, j;
diff --git a/src/klammail/client.c b/src/klammail/client.c
index 6382785..88ec4fb 100755
--- a/src/klammail/client.c
+++ b/src/klammail/client.c
@@ -22,8 +22,6 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <errno.h>
-
#include <stdio.h>
#include <unistd.h>
@@ -37,13 +35,16 @@
//#include "others.h"
#include "cfgparser.h"
+#include "defaults.h"
#include "memory.h"
#include "options.h"
-#include "defaults.h"
+#include "output.h"
//#include "shared.h"
#include <clamav.h>
-int client(const char *dirname, struct optstruct *opt, char **virname)
+int passfile(const char *file, int sockd, const char **virname);
+
+int client(const char *dirname, struct optstruct *opt, const char **virname)
{
char buff[4096], cwd[200], *file, *scancmd;
struct sockaddr_un server;
@@ -125,7 +126,7 @@ int client(const char *dirname, struct optstruct *opt, char **virname)
return scanret;
}
-int passfile(const char *file, int sockd, char **virname)
+int passfile(const char *file, int sockd, const char **virname)
{
char buff[4096];
diff --git a/src/klammail/options.c b/src/klammail/options.c
index ffefd48..c6ef22e 100755
--- a/src/klammail/options.c
+++ b/src/klammail/options.c
@@ -31,8 +31,7 @@
#endif
#include "options.h"
-//#include "others.h"
-//#include "shared.h"
+#include "output.h"
#include "memory.h"
void clamdscan(struct optstruct *opt);