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>
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>
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>
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>
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>
* 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>
[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>
This reverts commit 6126f7a53c
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>
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>
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>
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>
Make parameters passed to call_daemon() more descriptive:
- use UUIDD_OP_GETPID instead of magic number 0
- call_daemon() takes pointer as a last argument, so pass NULL instead
of 0
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Specifying the "-n" option to uuidd would incorrectly
fall through to the "-p" case, and assign that number to
the pidfile_path.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Having uuid_generate_time and uuid__generate_time at
the same time is confusing. These functions are exported,
but not part of the official API (used by uuidd only).
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Before this change, "uuidd -t -n 1" reported
"6fd0672e-2f9b-11e0-b9c8-000feae00cb0 and subsequent 1 UUIDs".
That is two subsequent UUIDs, which is not correct.
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>