summaryrefslogtreecommitdiffstats
path: root/misc-utils/uuidd.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* various: fix 'uninitialized when used' warnings [clang]Sami Kerola2019-02-181-1/+2
| | | | | | | This change fixes "warning: variable 'var' may be uninitialized when used here [-Wconditional-uninitialized]" warnings reported in various files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/timer: add fallback if timer_create() not availableKarel Zak2018-12-031-3/+5
| | | | | | | | | | | | | * add struct ul_timer as API abstraction to hide differences between timer_create() and setitimer() * add setitimer() detection to ./configure.ac * add fallback code to use setitimer() if timer_create() not available (for example on OSX) Addresses: https://github.com/karelzak/util-linux/issues/584 Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: cosmetic coding style changeKarel Zak2018-03-071-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: don't truncate long socket pathsRuediger Meier2018-03-071-4/+8
| | | | | | | | | | | | | This was the error uuidd: couldn't bind unix socket /var/tmp/portage/sys-apps/util-linux-2.31.1/work/util-linux-2.31.1-abi_x86_64.amd64/tests/output/uuid/uuiddkOcTUuoZ7kaP3: Address already in use because the socket path was truncated to 108 chars which was luckily an existing directory. Now we abort early with "uuidd: socket name too long: ... " Reported-by: Thomas Deutschmann <whissi@gentoo.org> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-051-3/+0Star
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* uuidd: remove unused defineRuediger Meier2017-06-221-6/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: remove unnecessary pidpile path variableSami Kerola2016-08-081-5/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-3/+2Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* uuidd: correct the wording of an error messageBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: fix typos found by codespellRuediger Meier2016-02-031-1/+1
| | | | | | Using "codespell" from https://github.com/lucasdemarchi/codespell Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* uuidd: add debug message for timeoutKarel Zak2015-10-091-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: use cxt->quietKarel Zak2015-10-091-7/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: fix compiler warning [-Wsign-compare]Karel Zak2015-10-091-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: fix shadow declarationSami Kerola2015-10-091-5/+5
| | | | | | | | misc-utils/uuidd.c:384:13: warning: declaration of 'ret' shadows a previous local [-Wshadow] misc-utils/uuidd.c:327:6: note: shadowed declaration is here Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: use signalfd() and setup_timer()Sami Kerola2015-10-091-39/+96
| | | | | | | | Point of this change is to replace use of signal() and alarm() system calls using newer interfaces. Nice side effect is that the point where timer was earlier used cannot be distracted by sending rogue SIGALRM. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blkid, uuidd, uuidgen: assume getopt.h and getopt.h are availableSami Kerola2015-10-091-8/+0Star
| | | | | | These headers are in use allover this project without issues. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: slice up the usage text and normalize its layoutSami Kerola2015-10-091-19/+17Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: improve socket activation error messagingSami Kerola2015-10-021-3/+11
| | | | | | | Tell more exactly what is wrong and how, and give hint how to recover when possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: use usage() text element macrosSami Kerola2014-10-011-2/+2
| | | | | | | Translating these text elements should happen only once, which is more likely when the text macros are used properly. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: do not mix signed type and unsigned codeSami Kerola2014-05-261-2/+2
| | | | | | Both the strtou32_or_err() and alarm() expect timeout to be unsigned. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: set options to be mutually exclusiveSami Kerola2014-05-261-3/+9
| | | | | | | | --pid || --no-pid --debug || --quiet --random || --time Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidd: ensure pid file is wrote when it is requestedSami Kerola2014-05-261-2/+4
| | | | | | | | | Earlier for example this 'uuidd --pid /dev/full' worked, now error is printed about truncating not being possible for character device and assuming someone would write pid to full disk it should not be go by unnoticed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: consolidate systemd supportKarel Zak2014-04-091-5/+5
| | | | | | | | | | | | | | | * systemd (since v209) uses only one library (when compiled without --enable-compat-libs) * all systemd build-sys stuff is merged into HAVE_SYSTEMD (automake) and HAVE_LIBSYSTEMD (C macro) now * all is controlled by --with-systemd, default is to automatically check for systemd libs * no more --enable-socket-activation and --enable-journald Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: use pkg-config to find systemd-deamon supportSami Kerola2014-01-071-5/+5
| | | | | | | | [kzak@redhat.com: - remove USE_SOCKET_ACTIVATION and use HAVE_* as we use for another libs] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: add missing initializer [clang-analyzer]Karel Zak2013-07-091-3/+3
| | | | | Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix typo in error message and uniformize their use of periodBenno Schulenberg2013-05-281-6/+6
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* uuidd: clean up error messagesKarel Zak2013-05-151-46/+31Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: use UTIL_LINUX_VERSION everywhereKarel Zak2013-01-251-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: move read_all to include/all-io.hPetr Uzel2012-05-151-24/+0Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-151-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: avoid double open and leaking fd (reworked)Petr Uzel2012-05-101-2/+2
| | | | | | | | | | | | | | This reverts commit 6126f7a53c57485a9a29ddd772765695f23c92e6 and fixes the double open and leaking descriptor in a different way, that is by using newly introduced function 'have_random_source()' to check whether good random source is available while deciding which uuid type to generate (random/time). This is better than calling random_get_fd() twice, passing the file descriptor down the stack and reusing it in next call to random_get_fd(). Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: remove unnecessary variablesKarel Zak2012-05-041-22/+16Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: avoid double open and leaking descriptorPetr Uzel2012-05-041-2/+2
| | | | | | | | | | | | | We are opening /dev/urandom twice in uuid_generate(): first to check if the file is available and then later __uuid_generate_random() again to actually get the random data. Moreover, descriptor from the first open is leaking. Fix by passign the descriptor down the stack and reusing it there. References: http://marc.info/?l=util-linux-ng&m=133406051131131&w=2 Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: introduce uuidd_cxt to pass arguments to server loopPetr Uzel2012-05-041-20/+36
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: do not drop privilegesPetr Uzel2012-05-041-31/+1Star
| | | | | | | | | | | | | libuuid can (for now) spawn uuidd on-demand. To support this scenario, uuidd should be installed setuid/setgid to have access to /var/lib/libuuid/clock.txt. Therefore, dropping the privileges is not functional, so removing this ability. Moreover, the ability to spawn uuidd on-demand will be removed anyway. References: http://www.spinics.net/lists/util-linux-ng/msg05934.html Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: print all debugging information to stderrPetr Uzel2012-05-041-14/+15
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --socket-activation optionPetr Uzel2012-05-041-44/+90
| | | | | | | | | | | | | | Implement --socket-activation option, which is supposed to be used with systemd (or equivalent init system) socket activation mechanism. With this option, the UUID daemon does not create the socket on its own, but instead expect the connection fd to be provided by the calling process. This option is only available if util-linux is configured with --enable-socket-activation option. With this configure option, the uuidd is compiled with sd-daemon.c. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: factor out socket creation into separate functionPetr Uzel2012-05-041-28/+46
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --no-fork optionPetr Uzel2012-05-041-6/+12
| | | | | | | With this option, uuidd does not daemonize itself but stays in the foreground. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: use ignore_result helperPetr Uzel2012-05-041-3/+2Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: implement --no-pid optionPetr Uzel2012-05-041-12/+36
| | | | | | With this option, uuidd does not create the PID file. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: factor out pidfile creation into separate functionPetr Uzel2012-05-041-14/+34
| | | | | | Introduce create_pidfile() function. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* uuidd: remove useless initialization of cleanup_socketPetr Uzel2012-05-041-1/+0Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>