Commit Graph
79 Commits
Author SHA1 Message Date
Joachim Nilsson 8978cb9bff Try sudo: true for sake of tests, skip Docker for now.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-23 01:39:08 +02:00
Joachim Nilsson 9c90ec56a6 Attempt to activate autotests in Travis-CI.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-23 01:33:24 +02:00
Joachim Nilsson 44e787c966 Add generic support for running tests as root.
By setting `ASROOT=1` in a unit test makefile a test will now run as
root, using `sudo -n`.

This patch allows us to simplify the pidfilefn() test.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-23 01:30:29 +02:00
Joachim Nilsson e8ff38ad6a Add autotest for fisdir()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 23:26:41 +02:00
Joachim Nilsson 1138822d19 Add autotest for fexist()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 23:22:38 +02:00
Joachim Nilsson de8f2b087c Add autotest for tempfile()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 23:08:22 +02:00
Joachim Nilsson 87d6fe822c Make sure to start the makepath() tests clean.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 23:07:56 +02:00
Joachim Nilsson 57c49bfe0c Add autotest for mkpath() and makepath()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 23:01:15 +02:00
Joachim Nilsson b59249714b Add autotest for fsendfile()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 22:49:48 +02:00
Joachim Nilsson 36da3aa35e Add autotest for dir
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 22:46:42 +02:00
Joachim Nilsson ab2b0f00fa Add autotest for pidfilefn et al.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 22:41:34 +02:00
Joachim Nilsson bd69aad13a Add autotest for copyfile et al.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 22:22:14 +02:00
Joachim Nilsson ebe2ad4a4c Add autotest for chomp
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 22:08:25 +02:00
Joachim Nilsson 2ea2357b62 Lay foundation for unit test build framework.
GNU Make double colon rules, rule ;-)

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 21:59:52 +02:00
Joachim Nilsson b7a8042c87 Add Travis-CI status icon
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 16:11:31 +02:00
Joachim Nilsson 7d1423b5b1 Add dockerized Travis-CI autobuilder support.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-22 16:09:54 +02:00
Joachim Nilsson 117ec58a90 Add some very useful helper macros: NELEMS() and bitops.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-21 09:42:43 +02:00
Joachim Nilsson a4cbc7a10e pidfile.c: Upgrade to OpenBSD r1.11, asprintf() fixes.
Do not assume that asprintf() clears the pointer on failure, which
   is non-portable.  Also add missing asprintf() return value checks.
   Signed-off-by: millert@
   Signed-off-by: deraadt@ guenther@ doug@

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-22 11:53:44 +02:00
Joachim Nilsson 3eb1fbb31d lite.h: Minor coding style cleanup.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-22 11:52:41 +02:00
Joachim Nilsson f5355ecf7b lite.h: Convert from error.h to the more BSD friendly err.h
OpenBSD, and possibly the other BSD's, do not have error.h so we replace
it with err.h, which exists almost everywhere.

This means the macros in lite.h that used error() now instead use
warn(),  with the same semantics as before.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-18 15:36:06 +02:00
Joachim Nilsson 61b1b5b457 Add support for 'make distdir' used by GNU configure and build.
This patch adds support for being called with "make distdir" from a GNU
configure and build based project.  This was a requirement to get the
Inadyn v1.99.14 release out.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-14 17:26:32 +02:00
Joachim Nilsson 83f83466b5 Fix indentation of description to some API's.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-12 13:13:21 +02:00
Joachim Nilsson 6d2717726f Shorten README title heading.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
v1.0.0
2015-07-12 12:50:01 +02:00
Joachim Nilsson 2675426845 Update README for release.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-12 12:44:39 +02:00
Joachim Nilsson 51c73030e0 Minor change.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-12 12:43:57 +02:00
Joachim Nilsson a9d11d0498 ifconfig.c: Fix possible NULL pointer deref.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 19:27:02 +02:00
Joachim Nilsson 1147e547dc Followup to atonum(), missing include file and const.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 19:06:17 +02:00
Joachim Nilsson 41c9caff17 Add atonum() - Convert string to natural number, returns -1 on error.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 19:00:11 +02:00
Joachim Nilsson 4005dd5e2c Add simple IPv4 only ifconfig() function from Finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 18:28:57 +02:00
Joachim Nilsson 614c8cbe47 Update documentation of OpenBSD derived functions with pointers to man pages.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 18:27:46 +02:00
Joachim Nilsson 8db314623a Followup to pidfilefn.c, add system include file for usleep()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 03:22:53 +02:00
Joachim Nilsson e731d83881 Add pidfile_poll() from Finit, waits max 5 sec for pidfile.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 03:19:56 +02:00
Joachim Nilsson c2d0ed0d12 Fix minor issues in pidfile_read() and pidfile_signal(), caught by Coverity
- Simplify pidfile_read(), no need to call access() when fopen() is more
  than capable of failing on its own if we do not have READ access.
- The remove() syscall requires that you check the return value, but we
  don't care about that when having signalled a TERM signal to a process.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:59:10 +02:00
Joachim Nilsson 5a50a6add1 Add client side pidfile functions: pidfile_read(), pidfile_signal().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:36:58 +02:00
Joachim Nilsson 9ed00baa94 Add pidfile() from NetBSD/OpenBSD, missing in GLIBC.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:25:19 +02:00
Joachim Nilsson 1561e7567e Add recursive mkpath() and makepath(), works like mkdir -p
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:25:19 +02:00
Joachim Nilsson c5366a33da fsendfile(): Break ABI by switching src and dst to match rest of API.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-06 02:04:28 +02:00
Joachim Nilsson af39ae5fa9 Refactor copyfile(), and copy_filep() --> fcopyfile() to use same backend.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-06 02:03:28 +02:00
Tobias Waldekranz 1423edc044 Factor out fsendfile() to reduce overall size when linking.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-05 15:21:55 +02:00
Joachim Nilsson c48ce14739 Default to silent build, use V=1 to get verbose mode.
Use kernel standard silent mode instead, and adopt kernel nomenclature
for enabling verbose mode.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-05 11:46:48 +02:00
Joachim Nilsson 6f19d1407a Default to verbose style build, use SILENT=1 to get silent mode.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-05 11:28:03 +02:00
Joachim Nilsson 436a07ee06 Remove STATIC ifdef, always build .a and .so files
Using libite as a GIT submodule in a autoconf/automake based project it
is non-trivial to set a separate environment variable when descending
into the libite subdirectory.

It is better to instead simplify the build process and always build both
.a and .so files.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-05 11:06:33 +02:00
Joachim Nilsson e37aad9530 Update on tmpfile() requirements.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-03 01:50:15 +02:00
Joachim Nilsson 32827cdea9 Add OpenBSD version of the extremely useful sys/queue.h API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-03 01:47:22 +02:00
Joachim Nilsson e4c5a0e77e copyfile(): Fix potentially dangerous time of check-time of use bug.
Coverity reports a potenatially TOCTOU bug, CWE-367, in copyfile().
Turns out we tried to fall back to copy when readlink() failed, in
the case when the user requested to copy symlinks.

It's better to fail hard if stat() reports symlink and readlink()
right after fails to read the symlink ...

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-22 22:39:59 +02:00
Joachim Nilsson 35b43c5c56 Handle missing O_TMPFILE gracefully and document tempfile() in README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-22 22:02:39 +02:00
Joachim Nilsson c5434a4bc0 Add tempfile() - a secure tmpfile() replacement using O_TMPFILE.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-22 21:42:38 +02:00
Joachim Nilsson 84c3667eba Default to -fPIC, bloats archives slightly, but works for everyone.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-18 02:24:17 +02:00
Joachim Nilsson 262f8b8936 Cleanup: Fix install/uninstall of both static and dynamic builds.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-18 02:14:55 +02:00
Joachim Nilsson c045bc7264 Add small clarification on licenses used in libite (-lite)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-18 01:06:05 +02:00