57 Commits
Author SHA1 Message Date
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
Joachim Nilsson 82ca189a52 Fix buggy chomp() -- Chop off only trailing newlines, all of them.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 23:45:39 +02:00
Joachim Nilsson 1b4dd15614 Document helper macros.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 23:10:50 +02:00
Tobias Waldekranz 121e8ee888 Add Westermo chomp() function, slightly improved from Finit original.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 22:07:10 +02:00
Joachim Nilsson 745256909e Shorten title.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 21:57:29 +02:00
Joachim Nilsson 552f917b9b Update README slightly.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 21:56:03 +02:00
Joachim Nilsson 08ce3d503e Add basic README.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 21:26:58 +02:00
Joachim Nilsson 22a79ee947 Make libite standalone
Add basic .gitignore, cleanup inherited Makefile from Finit
and add a small rules.mk from libuEv.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 21:13:02 +02:00
Joachim Nilsson 1758f9a847 rsync.c: Use makedir() from lite.h
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 20:57:05 +02:00
Joachim Nilsson 9f0979daea Add some helper macros and wrappers for C library functions.
- touch()    - Create a file, or update mtime.  Errors on stderr
- makedir()  - Create directory, like mkdir().  Errors on stderr
- makefifo() - Create a FIFO, like mkfifo().  Errors on stderr
- erase()    - Erase file/directory with remove().  Errors on stderr
- chardev()  - Create character device
- blkdev()   - Create block device
- S_ISEXEC() - Mysteriously missing from GLIBC
- UNUSED()   - Shorter and more readable version of __attribute__ ((unused))

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 20:56:07 +02:00
Joachim Nilsson 95922a9536 Add standard MIT/X11 license, from Finit.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 16:14:14 +02:00
Joachim Nilsson f35f64f06f Fix last part of issue #8: Libite install problem with --enable-static
Skip install of .so libs when user has configured with --enable-static

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-03-10 22:12:26 +01:00
Joachim Nilsson 8b7eb36d2a Overhaul build system and add support for disabling inetd support.
This patch adds support for a configure script and with it
support for disabling inetd support.  See the output from

    ./configure --help

* Add configure script
* Sprinkle #ifdef fairy dust on svc.c when inetd support is disabled
* Use GCC built-in autodep calculator (-MMD -MP)
* Fix name space issue with include files, use relative paths
* Disable username/group name to uid/gid functions in static builds
* Bug out (error) if a user tries to build the bootmisc plugin static

Possibly fixes GitHub issue #5 and issue #6.

NOTE: The static build has not received any testing at all!

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-03-10 10:25:46 +01:00
Joachim Nilsson 5e31d05110 Initial support for building Finit statically (incomplete)
This patch adresses issue #5.  However, there still remains a few issues
to work around before Finit can be built completely standalone.

    $ make clean all STATIC=1
    LINK    finit
    helpers.o: In function `getgroup':
    helpers.c:(.text+0x10a7): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    helpers.o: In function `getuser':
    helpers.c:(.text+0x108e): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    inetd.o: In function `getent':
    inetd.c:(.text+0x127): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    inetd.c:(.text+0xce): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

The problem is the NSS plugins and similar issues that prevent static
linking when using the above functions.  See issue #5 for more on this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-03-06 21:58:56 +01:00
Joachim Nilsson 5d184794b4 Fix various problems with unchecked return values from syscalls.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-11-27 00:12:07 +01:00
Joachim Nilsson 0701b688fd libite/rsync.c: Fix build regression from previous commit.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-11-26 23:37:04 +01:00
Joachim Nilsson e0c84e25a7 Fix problem with unchecked return value of mkdir(), wrap in makedir() macro.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-11-26 23:27:15 +01:00
Joachim Nilsson e540ea8735 libite:rsync.c - Break out nested function.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-10-31 14:56:51 +01:00
Joachim Nilsson 949d0a020f Bump version for release and update copyright years.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-21 16:03:54 +02:00
Joachim Nilsson 36d24ce366 lite.h: Add some helper string comparison methods.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-21 15:45:23 +02:00
Joachim Nilsson 80c2a132cd libite: Fix cppcheck warnings in rsync unit test
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-12 16:34:57 +02:00
Joachim Nilsson 5eb4f640b1 libite: Minor style cleanup of fsendfile()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-12 16:21:41 +02:00
Joachim Nilsson 6b64189d14 libite: Simplify and fix another memleak in copyfile()
- Simplify: reduce indentation depth
- Always check for error condition first, cleaner code
- Make sure buffer is always freed, use same exit everyhere
- Use readable, but still short, local variable names

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-12 16:11:59 +02:00