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>
Executing the daemon from the shared library is not quite elegant
solution. Drop this functionality and require uuidd (should it be
needed) to be started from the initscript or by socket-activation.
References: http://www.spinics.net/lists/util-linux-ng/msg05967.html
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>
libblkid is restrictive as to what it accepts as valid reiserfs or
valid NTFS. One can mkfs an NTFS with 256B sectors and it's supported
by ntfs-3g Reiserfs can have 512B blocks and it works both with
mkfs.ntfs and Linux.
Signed-off-by: Karel Zak <kzak@redhat.com>
DOS specific logic is currently embedded in the heart of fdisk code. This patch
separates DOS label specific code into its own file, just like the rest of the
labels, leaving a more generic fdisk.c file. Most changes are just moving code
from fdisk.c to fdisk.h and fdiskdoslabel.[c/h].
The only logical modification is calling dos_delete_partition() from
read_extended(), instead of the generic delete_partition. This is ok since
read extended is only called from a DOS context.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
When the device cannot be opened, there's no point calling fatal() when we can
just use err(3). When any other kind of fatal error occurs it's Ok, in addition
we can also go ahead and close the descriptor before exiting the program as
it's currently leaking.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
This patch eliminates the long/setjmp code. The current logic does not do
anything with stack jumps as it only exits from
print_partition_table_from_option() when a fatal error occurs.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Additionally to the fixes in commit v2.21-325-g455fe9a,
fix typos in release notes and NEWS.
Signed-off-by: Bernhard Voelker <mail@...>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
sfdisk.c: In function ‘do_fdisk’:
sfdisk.c:3212:11: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
fsck.minix.c: In function ‘ask’:
fsck.minix.c:263:7: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
libmount uses libblkid to detect filesystem type. Unfortunately, the
blkid probe struct is not freed before mount(2), it means that the
device is still open and mount(2) may return EBUSY.
We don't need persistent blkid stuff in libmount, so let's close
all immediately after device probing.
Reported-by: David Zeuthen <zeuthen@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
* all tt based utils will properly encode blank chars for raw output
format and quotes for export output format
Signed-off-by: Karel Zak <kzak@redhat.com>