Skip to content

Commit d716ae3

Browse files
Merge pull request #16 from K0001rch/stable-0.1
fix: #3 small code fix
2 parents f43551b + bcc98be commit d716ae3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

helpers/helpers_common.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int helpers_get_keep_running()
2424
return keep_running;
2525
}
2626

27-
// unused yet
27+
#if 0
2828
void helpers_mutex_trylock(pthread_mutex_t * mutex)
2929
{
3030
fprintf(stderr, "<%s>\n", __func__);
@@ -54,6 +54,7 @@ void helpers_mutex_trylock(pthread_mutex_t * mutex)
5454
}
5555
}
5656
}
57+
#endif
5758

5859
/* ===================== */
5960
/* HANDLE INOTIFY CALLS */
@@ -247,12 +248,16 @@ void * pthread_on_dir_run(void * argument)
247248
{
248249
if (HELPERS_INVALID_EXIT == process_inotify_events(queue, inotify_fd, arg))
249250
{
251+
if (queue)
252+
queue_destroy(queue);
250253
goto out;
251254
}
252255
}
253256

254257
if (HELPERS_INVALID_EXIT == close_inotify_fd(inotify_fd))
255258
{
259+
if (queue)
260+
queue_destroy(queue);
256261
goto out;
257262
}
258263
queue_destroy(queue);
@@ -387,7 +392,7 @@ static void handle_event(queue_entry_t event, thread_argument_t * arg)
387392
}
388393
default:
389394
{
390-
// need for handle CTRL+S signal to saving file
395+
// need for handle CTRL+S signal to saving file (for example)
391396
sprintf(message_buffer, "UNKNOWN EVENT \"%X\" OCCURRED for file \"%s\", need to backup",
392397
event->inot_ev.mask, cur_event_filename);
393398
need_to_backup = true;

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,4 @@ int main(int argc, char * argv[])
203203

204204
pthread_mutex_destroy(&mutex);
205205
return free_and_exit(rc);
206-
}
206+
}

0 commit comments

Comments
 (0)