summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
2015-09-15u-a: Fix memory leak in alternative_config_all()Guillem Jover1-1/+3
Warned-by: coverity
2015-09-14u-a: Remove subcall and surrounding codeGuillem Jover1-51/+0
This function and macros are unused, now that all commands have been reimplemented fully as built-ins.
2015-09-14u-a: Reimplement --set-selections as a built-in commandGuillem Jover1-10/+12
Do not execute itself with --set or --auto for each alternative to set a selection for, just handle them in-process.
2015-09-14u-a: Reimplement --all as a fully built-in commandGuillem Jover1-14/+25
Do not execute itself with --config for each alternative to configure, just handle them all in-process.
2015-09-14u-a: Move selection functions after alternative_update()Guillem Jover1-123/+123
We will need to use functions defined further down the file, so let's move these ones after alternative_update().
2015-09-14u-a: Refactor config, remove, set_manual and set_auto actionsGuillem Jover1-47/+89
This simplifies the main() function, and will allow reusing some of these new functions to avoid having to call itself.
2015-09-14u-a: Rename alternative_remove to alternative_remove_filesGuillem Jover1-2/+2
We will use this name for the actual alternative remove action.
2015-09-14u-a: Move current best alternative from the trail to the headGuillem Jover1-6/+5
No callers have been found in Debian parsing the best version of an alternative.
2015-09-14u-a: Print master and slave links on --displayGuillem Jover1-0/+3
2015-09-14s-s-d: Fix short-lived memory leaksGuillem Jover1-13/+30
As a side effect now a missing group after ‘:’ on --chuid is a fatal error. Warned-by: coverity
2015-05-09s-s-d: Cleanup timespec_mul()Guillem Jover1-3/+4
2015-05-09s-s-d: Switch to use a monotonic clock if availableGuillem Jover1-0/+7
Use clock_gettime(CLOCK_MONOTONIC) if available instead of gettimeofday() which gets affected by abrupt system clock changes, and might mess with the timeout calculations. Closes: #783014 Suggested-by: Jose M Calhariz <jose.calhariz@hds.com>
2015-05-09s-s-d: Switch to use timespec instead of timevalGuillem Jover1-23/+53
Switch to use pselect() instead of select().
2015-05-09s-s-d: Do not leak kvm descriptorsGuillem Jover1-10/+34
Cherry picked from commit eaa073bc37901a6d8c46abc9fa5e7ec5551df04b. We should close the kvm instances after every operation, so not to leak them, as they might exhaust the file descriptor pool, or leak into the started process. Closes: #779467 Based-on-patch-by: Jeff Epler <jepler@unpythonic.net>
2015-04-18debian: Update my copyright yearsGuillem Jover1-1/+1
2015-04-10Consistently use proper quotation marks all over the placeGuillem Jover1-6/+6
That is "" or '', and not the unbalanced `' pair.
2015-03-31Use "<enter>" instead of "return" or "enter" in input promptsGuillem Jover1-1/+1
This should make it more clear we are talking about the key and not something else.
2015-01-28test: Move use strict and warnings as the first directivesGuillem Jover1-5/+7
2014-10-23u-a: Inline alternative status description into translatable stringGuillem Jover1-3/+6
This makes it possible to correctly translate the string. Required-by: #766311
2014-10-20s-s-d: Add a new --remove-pidfile optionGuillem Jover1-0/+19
This is the counter-option to --make-pidfile, so that programs that need their pidfile created can use an option to remove them without needing to do that manually.
2014-10-16s-s-d: Create a pidfile even when not backgrounding ourselvesGuillem Jover1-0/+3
Regression introduced in commit 29778da537e2ff1a0f032db33dde43413b7345ef. When the user asked us to create the pidfile, but _not_ to background ourselves, we should still create the pidfile. This usage is somewhat dubious, as s-s-d has an option to background, which is better in any way, as it will make sure to return error codes in case the program cannot be started for whatever reason. But it's still a regression. Closes: #765110
2014-10-06s-s-d: Do not fail when kvm_getprocs() cannot find any processGuillem Jover1-1/+9
Return NULL, and let the call sites return false themselves. This fixes the code failing on retries when the process has disappeared.
2014-10-06s-s-d: On kFreeBSD do not make kvm_openfiles() open /dev/memGuillem Jover1-1/+6
We do not need that file, as we are not using any kvm_read(3) call, either explicitly or implicitly. Everything is retrieved through sysctl(2). libkvm from FreeBSD allows to pass /dev/null as the memory file to denote that we do not need it. This will make s-s-d work again on jails which do not usually have /dev/mem available. Reported-by: Steven Chamberlain <steven@pyro.eu.org>
2014-10-06s-s-d: Refactor KVM codeGuillem Jover1-39/+44
Create two new functions, ssd_kvm_open() and ssd_kvm_get_procs().
2014-10-06s-s-d: Do not abort on --stop when only pid or ppid options are specifiedChristos Trochalakis1-0/+4
When running with «--stop» and only pid or ppid as matching options, start-stop-daemon aborts with a "no match option" error. «pid» and «ppid» are proper matching options, so they should be enough to proceed. Missed in commits 80de58344cb38ab085ca2c7808f4f7b3be1d2422 and 3fabf94e0b5fe1bcdea26fecee1c87e74fab98b2. Closes: #763767 Signed-off-by: Guillem Jover <guillem@debian.org>
2014-10-06s-s-d: Make sure the pidfile is always created with a 022 umaskGuillem Jover1-4/+5
Although this got partially corrected with the fix for the background and pidfile creation bug, it still migth happen that the parent had a too restrictive umask. Closes: #760222 Reported-by: Will Conley <willconley3@gmail.com>
2014-10-06s-s-d: Do not exit from first parent before the pidfile has been createdGuillem Jover1-5/+53
When using the --background option combined with --make-pidfile, the parent process might end up exiting before the child's pidfile has been created, which might confuse service supervising programs. Fix the race condition by making the first parent wait for the second one, so that it can safely create the pidfile if required. Closes: #686420 Based-on-patch-by: Nir Soffer <nirs@hyperms.com>
2014-10-06s-s-d: Move write_pidfile() before daemonize()Guillem Jover1-21/+21
We'll be needing to call the former in the latter.
2014-10-06s-s-d: Abort if the system or compatibility setsid() failsGuillem Jover1-2/+5
This requires to check the setpgid() return value in the setsid() compatibility function.
2014-10-06build: Split test_programs and test_scripts out of test_casesGuillem Jover1-2/+3
We do not need TEST_PREFIX anymore, as the prefixes are implicit for each typo of test case. Use the build directory for compiled programs and the source directory for scripts.
2014-08-19s-s-d: Switch GNU/kFreeBSD systems to use libkvmGuillem Jover1-2/+2
Use libkvm instead of relying on linprocfs, which is not the native procfs on kFreeBSD, and it is usually not mounted as FreeBSD programs do not expect it to be present. This stops making the code handle GNU/kFreeBSD as if it was a Linux-based system.
2014-08-15s-s-d: Remove wasteful strlen() comparison before strcmp()Guillem Jover1-2/+0
2014-06-05s-s-d: Add DragonFlyBSD supportGuillem Jover1-0/+13
Closes: #734452 Based-on-patch-by: Hleb Valoshka <375gnu@gmail.com>
2014-05-28u-a: Uppercase altdb_flags enum valuesGuillem Jover1-9/+9
2014-05-28u-a: Uppercase opcode enum valuesGuillem Jover1-11/+11
2014-05-28s-s-d: Uppercase status_code enum valuesGuillem Jover1-22/+22
2014-05-28s-s-d: Uppercase action_code enum valuesGuillem Jover1-17/+17
2014-05-17s-s-d: Cope with bogus OpenVZ kernels that prepend the " (deleted)" markerGuillem Jover1-4/+12
There are OpenVZ Linux kernels that instead of appending, prepend the deleted marker, making the exec check fail to match. Add a workaround so that those systems do not get affected. This will still be affecting any other userland tool that checks the /proc/PID/exe symlink, and might end up helping this behaviour to get entrenched, but better this than the getting strange system failures. Closes: #731530
2014-05-17u-a: Switch from alternative_has_choice() to checking if fs is NULLGuillem Jover1-3/+4
We are performing the same search twice, let's just reuse the fs pointer to decide if we have found the choice. This was confusing coverity, and making it think that alternative_has_broken_slave() could get fs with a NULL value. Warned-by: coverity
2014-05-17u-a: Fix TOCTOU race in rename_mv()Guillem Jover1-13/+9
This does not have any security implications, but it makes the code more robust. Warned-by: coverity
2014-05-17u-a: Fix TOCTOU race when loading an alternativeGuillem Jover1-11/+10
This does not have any security implications, but it makes the code more robust. Warned-by: coverity
2014-05-17build: Switch to use libtool for the static librariesGuillem Jover1-2/+2
This makes it possible to embed libcompat inside libdpkg, so that the static library that we ship is self contained with the required compatibility code, specifically the MD5 functions. This also prepares the build system for when we start building a shared library, although it disables it by default. Closes: #746122
2014-04-30s-s-d: Fix off-by-one stack buffer overrun on GNU/Linux and GNU/kFreeBSDGuillem Jover1-2/+2
This might happen if the executable pathname is longer than _POSIX_PATH_MAX. Although this should not have security implications as the buffer is surrounded by two arrays (so those catch accesses even if the stack grows up or down), and we are compiling with -fstack-protector anyway. We just need to always leave room for the final NUL character. Warned-by: coverity
2014-04-30u-a: Fix memory leaks in alternative_parse_fileset()Guillem Jover1-0/+4
Free prio_str and master_file. Warned-by: coverity
2014-04-21s-s-d: Add a new --ppid matching optionGuillem Jover1-2/+91
This allows to check for processes with a specific parent PID. Suggested-by: Alex Mestiashvili <mailatgoogl@gmail.com>
2014-04-21s-s-d: Detect system specific headers at configure timeGuillem Jover1-15/+16
Instead of hardcoding their usage depending on system macros.
2014-04-21s-s-d: Move Hurd specific headers after all standard headersGuillem Jover1-5/+5
2014-04-21s-s-d: Fix OpenBSD KVM code to use current kinfo_proc layoutGuillem Jover1-0/+6
2014-04-21s-s-d: Add a native FreeBSD pid_is_exec() methodGuillem Jover1-0/+26
Use the KERN_PROC_PATHNAME sysctl interface to retrieve the process pathname. This will allow to stop requiring the linprocfs fileystem which is not the native procfs and is not usually mounted by default anyway. This still has the problem that the pathname cannot be retrieved when the inode has been unlinked, in the same way as when accessing the /proc/<PID>/exe symlink from linprocfs.
2014-04-21s-s-d: Fix FreeBSD KVM code to use current kinfo_proc layoutGuillem Jover1-0/+16