Browse code

Fix to alleviate symbol name collision for temp directory globals in freshclam, libfreshclam when building static mode for fuzz targets.

Micah Snyder authored on 2019/05/23 05:54:55
Showing 1 changed files
... ...
@@ -66,11 +66,11 @@
66 66
 
67 67
 #define DEFAULT_SERVER_PORT 443
68 68
 
69
-int g_sigchildWait             = 1;
70
-short g_terminate              = 0;
71
-short g_foreground             = -1;
72
-const char *g_pidfile          = NULL;
73
-char g_tempDirectory[PATH_MAX] = {0};
69
+int g_sigchildWait                      = 1;
70
+short g_terminate                       = 0;
71
+short g_foreground                      = -1;
72
+const char *g_pidfile                   = NULL;
73
+char g_freshclamTempDirectory[PATH_MAX] = {0};
74 74
 
75 75
 typedef struct fc_ctx_ {
76 76
     uint32_t bTestDatabases;
... ...
@@ -109,8 +109,8 @@ sighandler(int sig)
109 109
             break;
110 110
 #endif
111 111
         default:
112
-            if (*g_tempDirectory)
113
-                cli_rmdirs(g_tempDirectory);
112
+            if (*g_freshclamTempDirectory)
113
+                cli_rmdirs(g_freshclamTempDirectory);
114 114
             if (g_pidfile)
115 115
                 unlink(g_pidfile);
116 116
             logg("Update process terminated\n");
... ...
@@ -868,8 +868,8 @@ static fc_error_t initialize(struct optstruct *opts)
868 868
     }
869 869
 
870 870
     /* Store the path of the temp directory so we can delete it later. */
871
-    strncpy(g_tempDirectory, fcConfig.tempDirectory, sizeof(g_tempDirectory));
872
-    g_tempDirectory[sizeof(g_tempDirectory) - 1] = '\0';
871
+    strncpy(g_freshclamTempDirectory, fcConfig.tempDirectory, sizeof(g_freshclamTempDirectory));
872
+    g_freshclamTempDirectory[sizeof(g_freshclamTempDirectory) - 1] = '\0';
873 873
 
874 874
 #ifndef _WIN32
875 875
     /*
... ...
@@ -1947,8 +1947,8 @@ done:
1947 1947
     fc_cleanup();
1948 1948
 
1949 1949
     /* Remove temp directory */
1950
-    if (*g_tempDirectory) {
1951
-        cli_rmdirs(g_tempDirectory);
1950
+    if (*g_freshclamTempDirectory) {
1951
+        cli_rmdirs(g_freshclamTempDirectory);
1952 1952
     }
1953 1953
 
1954 1954
     if ((FC_UPTODATE == status) || (FC_SUCCESS == status)) {