Skip to content

Commit 5029485

Browse files
committed
directory-monitor: Even though we disabled inotify on (Free)BSD now, the directory-monitor factory is now prepared for the case once we will support it as well on BSD systems
Signed-off-by: Hofi <[email protected]>
1 parent ff919ed commit 5029485

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

modules/affile/directory-monitor-factory.c

+11-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ directory_monitor_factory_get_monitor_method(const gchar *method)
4848
{
4949
return MM_INOTIFY;
5050
}
51-
#elif SYSLOG_NG_HAVE_KQUEUE
51+
#endif
52+
#if SYSLOG_NG_HAVE_KQUEUE
5253
else if (strcmp(method, "kqueue") == 0)
5354
{
5455
return MM_KQUEUE;
@@ -61,30 +62,26 @@ DirectoryMonitorConstructor
6162
directory_monitor_factory_get_constructor(DirectoryMonitorOptions *options)
6263
{
6364
DirectoryMonitorConstructor constructor = NULL;
65+
6466
#if SYSLOG_NG_HAVE_INOTIFY
6567
if (options->method == MM_AUTO || options->method == MM_INOTIFY)
6668
{
6769
constructor = directory_monitor_inotify_new;
6870
}
69-
else if (options->method == MM_POLL)
70-
{
71-
constructor = directory_monitor_poll_new;
72-
}
73-
#elif SYSLOG_NG_HAVE_KQUEUE
74-
if (options->method == MM_AUTO || options->method == MM_KQUEUE)
71+
#endif
72+
73+
#if SYSLOG_NG_HAVE_KQUEUE
74+
if (constructor == NULL && (options->method == MM_AUTO || options->method == MM_KQUEUE))
7575
{
7676
constructor = directory_monitor_kqueue_new;
7777
}
78-
else if (options->method == MM_POLL)
79-
{
80-
constructor = directory_monitor_poll_new;
81-
}
82-
#else
83-
if (options->method == MM_AUTO || options->method == MM_POLL)
78+
#endif
79+
80+
if (constructor == NULL && (options->method == MM_AUTO || options->method == MM_POLL))
8481
{
8582
constructor = directory_monitor_poll_new;
8683
}
87-
#endif
84+
8885
return constructor;
8986
}
9087

0 commit comments

Comments
 (0)