Skip to content
Snippets Groups Projects
Commit 6d7f8568 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't use uninitialized variable: lockfname

Where's the compiler warnings guys?
parent 813072cd
No related branches found
No related tags found
No related merge requests found
Pipeline #7193 passed
...@@ -2793,7 +2793,6 @@ static bool is_time_to_run(time_t now, const qhub_t* hub) ...@@ -2793,7 +2793,6 @@ static bool is_time_to_run(time_t now, const qhub_t* hub)
void event_thread(void* arg) void event_thread(void* arg)
{ {
char str[MAX_PATH+1]; char str[MAX_PATH+1];
char lockfname[MAX_PATH+1];
int i,j; int i,j;
int file; int file;
int offset; int offset;
...@@ -2925,11 +2924,11 @@ void event_thread(void* arg) ...@@ -2925,11 +2924,11 @@ void event_thread(void* arg)
sbbs->lprintf(LOG_INFO," %s exists (unpack in progress?) since %s", lockfile.name, time_as_hhmm(&sbbs->cfg, lockfile.time, str)); sbbs->lprintf(LOG_INFO," %s exists (unpack in progress?) since %s", lockfile.name, time_as_hhmm(&sbbs->cfg, lockfile.time, str));
continue; continue;
} }
sbbs->lprintf(LOG_DEBUG, "Opened %s", lockfname); sbbs->lprintf(LOG_DEBUG, "Opened %s", lockfile.name);
if(!fexist(fname)) { if(!fexist(fname)) {
sbbs->lprintf(LOG_DEBUG, "%s already gone", fname); sbbs->lprintf(LOG_DEBUG, "%s already gone", fname);
if(!fmutex_close(&lockfile)) if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfname); sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
continue; continue;
} }
sbbs->online=ON_LOCAL; sbbs->online=ON_LOCAL;
...@@ -2957,7 +2956,7 @@ void event_thread(void* arg) ...@@ -2957,7 +2956,7 @@ void event_thread(void* arg)
sbbs->delfiles(str, badpkt, /* keep: */10); sbbs->delfiles(str, badpkt, /* keep: */10);
} }
if(!fmutex_close(&lockfile)) if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfname); sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
} }
else { else {
sbbs->lprintf(LOG_INFO, "Removing: %s", fname); sbbs->lprintf(LOG_INFO, "Removing: %s", fname);
...@@ -2993,11 +2992,11 @@ void event_thread(void* arg) ...@@ -2993,11 +2992,11 @@ void event_thread(void* arg)
sbbs->lprintf(LOG_INFO,"%s exists (pack in progress?) since %s", lockfile.name, time_as_hhmm(&sbbs->cfg, lockfile.time, str)); sbbs->lprintf(LOG_INFO,"%s exists (pack in progress?) since %s", lockfile.name, time_as_hhmm(&sbbs->cfg, lockfile.time, str));
continue; continue;
} }
sbbs->lprintf(LOG_DEBUG, "Opened %s", lockfname); sbbs->lprintf(LOG_DEBUG, "Opened %s", lockfile.name);
if(!fexist(fname)) { if(!fexist(fname)) {
sbbs->lprintf(LOG_DEBUG, "%s already gone", fname); sbbs->lprintf(LOG_DEBUG, "%s already gone", fname);
if(!fmutex_close(&lockfile)) if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfname); sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
continue; continue;
} }
if(!(sbbs->useron.misc&(DELETED|INACTIVE))) { if(!(sbbs->useron.misc&(DELETED|INACTIVE))) {
...@@ -3024,7 +3023,7 @@ void event_thread(void* arg) ...@@ -3024,7 +3023,7 @@ void event_thread(void* arg)
} }
sbbs->fremove(WHERE, fname); sbbs->fremove(WHERE, fname);
if(!fmutex_close(&lockfile)) if(!fmutex_close(&lockfile))
sbbs->errormsg(WHERE, ERR_CLOSE, lockfname); sbbs->errormsg(WHERE, ERR_CLOSE, lockfile.name);
} }
globfree(&g); globfree(&g);
sbbs->useron.number = 0; sbbs->useron.number = 0;
......
  • Maintainer

    The variable lockfname is completely initialized as a pointer to a location on the stack... and you're not using the values of the members, just passing it as a pointer to a function that may very well be initializing the members for you. :smile:

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment