diff options
-rw-r--r-- | libinotifytools/src/inotifytools.c | 10 | ||||
-rw-r--r-- | libinotifytools/src/test.c | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c index 8fd50f6..fb9d4c9 100644 --- a/libinotifytools/src/inotifytools.c +++ b/libinotifytools/src/inotifytools.c @@ -500,8 +500,14 @@ int inotifytools_str_to_event_sep(char const * event, char sep) { len = strlen(event1); } if ( len > 4095 ) len = 4095; - strncpy( eventstr, event1, len ); - eventstr[len] = 0; + + if (event2) { + strncpy(eventstr, event1, len); + } else { + strcpy(eventstr, event1); + } + + eventstr[len] = 0; ret1 = onestr_to_event( eventstr ); if ( 0 == ret1 || -1 == ret1 ) { diff --git a/libinotifytools/src/test.c b/libinotifytools/src/test.c index dafcb55..2e2238d 100644 --- a/libinotifytools/src/test.c +++ b/libinotifytools/src/test.c @@ -245,9 +245,9 @@ void tst_inotifytools_snprintf() { inotifytools_set_printf_timefmt("%D%% %H:%M"); { char expected[1024]; - char timestr[1024]; + char timestr[512]; time_t now = time(0); - strftime(timestr, 1024, "%D%% %H:%M", localtime(&now)); + strftime(timestr, 512, "%D%% %H:%M", localtime(&now)); snprintf(expected, 1024, "Event ACCESS ACCESS on %s/ %s", TEST_DIR, timestr); inotifytools_snprintf(buf, 1024, test_event, |