- 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>
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>
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>
- 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>
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>
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>
- 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>