Replace inline version of similar, but less complete, functionality
with the lib/blkdev.c function. The function will inform if a type is
unknown, which appears as hex string value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
possible bashism in misc-utils/uuidd.rc line 52 (should be >word 2>&1):
if pidofproc -p $PIDFILE $DAEMON >& /dev/null ; then
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Move these functions to the top of the file where they can be marked
static and the prototypes can be removed.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This is done for us via an atexit hook since c05a80ca63. Avoids a
useless 'Write error' on exit whenever invoking the tool.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
If no tabfiles are specified, default to watching /proc/self/mountinfo
rather than exiting silently with EXIT_FAILURE.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
blkid -p dev1 dev2 [...] now stops upon first error detected and
returns correct value. Previously, if error was detected with dev1,
it continued with dev2 anyways and so the return value corresponded
to the last device only.
Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
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>
Add systemd unit files which use the socket activation mechanism
of systemd. The uuidd deamon is started upon first request on the
socket and quits after 1 minute of inactivity.
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>
findmnt.c:333:29: error: ‘vfs_attr’ may be used uninitialized in this function [-Werror=uninitialized]
findmnt.c:307:11: note: ‘vfs_attr’ was declared here
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Use the newly exported mnt_get_mountpoint to determine the device that a
given file resides on, in case the supplied source or target is not
explicitly a mount point.
http://www.spinics.net/lists/util-linux-ng/msg06081.html
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:
$ git ls-files | grep -v ^po/ | misspellings -f -
* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
Fedora 17 (/bin is symlink to /usr/bin):
[root@intel ~]# /bin/namei /bin/namei
f: /bin/namei
d /
l bin -> usr/bin
usr - No such file or directory
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>