commit de7bb00b0c877c5895341c28e01ae6408df2a06c
parent f986aa1d86442c48afd6cb89f1fca2d5c31de20f
Author: wwp <wwp@free.fr>
Date: Wed, 11 Jan 2017 16:09:08 +0100
Quit function if no connection instead of assigning variable that
will be overwriten right after.
Fixes Coverity CID #1372370.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -513,7 +513,7 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) {
}
sock = create_socket();
if (sock < 0) {
- debug_print("no connection\n");
+ debug_print("no connection (socket create)\n");
return NO_CONNECTION;
}
memset(buf, '\0', sizeof(buf));
@@ -535,8 +535,8 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) {
command = g_strconcat(scan, " ", path, "\n", NULL);
debug_print("command: %s\n", command);
if (write(sock, command, strlen(command)) == -1) {
- debug_print("no connection\n");
- stat = NO_CONNECTION;
+ debug_print("no connection (socket write)\n");
+ return NO_CONNECTION;
}
g_free(command);
memset(buf, '\0', sizeof(buf));