summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
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-26Merge git://anonscm.debian.org/dpkg/dpkgIgor Pashev3-96/+111
Conflicts: cputable debian/changelog
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-06-01Use proper pid_is_child on SunOSIgor Pashev1-1/+1
2014-06-01Finish up OSsunos support in start-stop-daemonJustin Maggard1-6/+80
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-05-08Merge git://anonscm.debian.org/dpkg/dpkgIgor Pashev4-46/+239
Conflicts: debian/changelog utils/start-stop-daemon.c
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
2014-04-21s-s-d: Add a generic KVM implementation for do_procinit()Guillem Jover1-2/+27
This uses the traditional BSD kinfo_proc layout.
2014-04-21s-s-d: Remove unnecessary pointer reference and dereference danceGuillem Jover1-1/+1
2014-04-21s-s-d: Use symbolic names for option codesGuillem Jover1-2/+4
2014-04-21s-s-d: Refactor Linux comm retrieval and switch to use /proc/PID/statusGuillem Jover1-17/+39
This trades parsing ambiguities due to process names with ‘)’ for ones with embedded ‘\n’. But it should be more robust and future proof in general, and allows to retrieve any field by name, which makes the code more clear and reusable.
2014-04-21test: Remove sequence number prefixes from test case filenamesGuillem Jover2-2/+2
This stops the madness of having to invent sequence numbers to be able to order the test suite run. Instead we now honour the order of the arguments passed to the runner.
2014-04-21build: Rename Makecheck.am to just check.amGuillem Jover1-1/+1
The original name was confusing with Makefile.am, let's be more clear.
2014-01-30Merge git://anonscm.debian.org/dpkg/dpkgIgor Pashev3-164/+251
Conflicts: debian/changelog debian/rules dpkg-deb/build.c man/dpkg-deb.1 scripts/Dpkg/Shlibs.pm scripts/Dpkg/Shlibs/SymbolFile.pm
2014-01-15Rename return code variables from r to rcGuillem Jover2-6/+8
2014-01-15Use dead_pid instead of r as variable name for waitpid() return valueGuillem Jover1-3/+3
2014-01-15Give better names to variables in malloc replacement functionsGuillem Jover1-4/+4
2013-12-17s-s-d: Add new --pid optionGuillem Jover1-3/+31
This option is useful when the user knows the pid of the process to act on, and wants to use some of the features from s-s-d, w/o needing to create a fake pid file. Closes: #253265
2013-12-12u-a: Fix a segfault when adding a new slave link to a link groupGuillem Jover1-1/+1
Return the correct slave link from alternative_add_slave(), instead of the typoed sl variable. Regression introduced in commit 9bbdca83fa1a8c817a2f8d02db493f173435a5af. Closes: #731710 Reported-by: Julian Andres Klode <jak@debian.org> Tested-by: Julian Andres Klode <jak@debian.org> Tested-by: Roland Stigge <stigge@debian.org>
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover2-2/+2
2013-12-05Switch variables from int to bool where appropriateGuillem Jover1-9/+9
2013-10-16u-a: Change mark to be a character instead of a stringGuillem Jover1-4/+4
2013-10-16u-a: Unify idx handling in alternative_select_choice()Guillem Jover1-5/+3
Make it obvious the 0 passed to alternative_print_choice() is the idx, and move the increment in the for loop into the post action.
2013-10-16u-a: Refactor out choice printing into its own functionGuillem Jover1-17/+19
2013-10-16u-a: Compute unchanging select choice variables just onceGuillem Jover1-6/+7
Instead of computing them on every loop, do so only once before entering the loop.
2013-10-16u-a: Rename DPKG_TMP_EXT to ALT_TMP_EXTGuillem Jover1-10/+10
Although we are still using dpkg specific file extensions for the temp files, it's one step further in untangling it from dpkg.