Fix bug #167 - Build errors on OpenBSD.

- Don't link with -ldl, as it is not needed in most cases
- Don't compile plugins if USE_PLUGINS=NO
- Fix warning about missing newline at end of getopt.h
- Removed the O_NOATIME open() flag from the logging plugin.
- Removed the O_LARGEFILE open() flag. _FILE_OFFSET_BITS is 64.
- Use fsync() if fdatasync() is not available for log file writing.
- Replaced some sprintf() with snprintf() due to compiler warnings (though, they were length limited otherwise).
- Replaced two occurences of strcpy() with memcpy().
This commit is contained in:
Jan Vidar Krey
2011-11-30 12:19:37 +01:00
parent 9981acca08
commit 2396d8555c
6 changed files with 32 additions and 23 deletions

View File

@@ -26,4 +26,5 @@ extern int optind;
extern int getopt(int argc, char* const argv[], const char *optstring);
#endif
#endif /* NEED_GETOPT */

View File

@@ -399,7 +399,7 @@ const char* get_timestamp(time_t now)
{
static char ts[32] = {0, };
struct tm* t = localtime(&now);
sprintf(ts, "[%02d:%02d]", t->tm_hour, t->tm_min);
snprintf(ts, sizeof(ts), "[%02d:%02d]", t->tm_hour, t->tm_min);
return ts;
}