diff options
author | Eric Curtin <ericcurtin17@gmail.com> | 2020-01-29 10:17:06 +0000 |
---|---|---|
committer | Eric Curtin <ericcurtin17@gmail.com> | 2020-01-29 10:17:06 +0000 |
commit | 13bab5a796cc4fdb4df7b39faa2d6a6d3b14441e (patch) | |
tree | 16da7ce5578c41093edd64f0ccda20296c5d21f8 | |
parent | 298fb6acd3ace345333acb45bc4df4cfa03052cb (diff) | |
download | inotify-tools-13bab5a796cc4fdb4df7b39faa2d6a6d3b14441e.zip inotify-tools-13bab5a796cc4fdb4df7b39faa2d6a6d3b14441e.tar.gz inotify-tools-13bab5a796cc4fdb4df7b39faa2d6a6d3b14441e.tar.bz2 |
Support for gcc 9
-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, |