Commit Graph

602 Commits

Author SHA1 Message Date
Sami Kerola 0518765347 lsblk: use exclusive_option()
This commit fixes exclusions which where meant to happen, but where not
successful.  For example

lsblk -r -l	# did exclude
lsblk -l -r	# did not exclude

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Sami Kerola fb9a004206 findmnt: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Sami Kerola 72b99fc53b blkid: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Karel Zak 9d738ff822 lsblk: use fallback for TYPE
... bug introduced by 1edd8af70b

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-15 13:13:40 +02:00
Sami Kerola 1edd8af70b lsblk: use blkdev_scsi_type_to_name()
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>
2012-06-11 22:06:06 +02:00
Sami Kerola 4f0537374f wipefs: use symbolic value for markup mode
In case mode value is found to be out of bounds program will crash.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 22:06:05 +02:00
Sami Kerola 0e9b73d3fb build: fix redundant redeclaration warnings
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:51:35 +02:00
Sami Kerola 7244ad8c09 uuidd: use output redirection which works [checkbashisms]
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>
2012-06-11 19:50:40 +02:00
Sami Kerola 41420120a8 blkid: fix realloc memory leak [cppcheck]
[misc-utils/blkid.c:367]: (error) Common realloc mistake: 'str' nulled but not freed upon failure

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:50:35 +02:00
Dave Reisner 283d626b36 logger: use memcpy instead of bcopy
bcopy is marked legacy in POSIX.1-2001 and should not be used.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-29 09:33:14 +02:00
Dave Reisner 82054b1d99 logger: mark decode/pencode as static
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>
2012-05-29 09:32:13 +02:00
Dave Reisner 652add4c2c logger: avoid explicit fclose(stdout)
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>
2012-05-29 09:32:10 +02:00
maximilian attems adddfd37a1 misc-utils: cleanup unused strings.h includes
Noticed on klibc building.

Signed-off-by: maximilian attems <max@stro.at>
2012-05-23 10:31:12 +02:00
Dave Reisner b8a670aecf findmnt: fallback to mountinfo for polling
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>
2012-05-23 09:56:51 +02:00
Dave Reisner beda9dd309 findmnt: reference correct manual section
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-23 09:56:51 +02:00
Petr Uzel 078ad9bf06 blkid: stop device probing if error is detected
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>
2012-05-23 09:43:51 +02:00
Petr Uzel 1578ddd658 blkid: introduce symbolic names for different blkid exit codes
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-23 09:43:51 +02:00
Petr Uzel a922091df8 blkid: use symbolic exit code
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-23 09:43:50 +02:00
Karel Zak 495b13983e Merge branch 'master' of https://github.com/jhuntwork/util-linux 2012-05-23 09:39:40 +02:00
Karel Zak db41a4298f misc-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:44:37 +02:00
Karel Zak 7e9a9af14f include/ttyutils: more robust get_terminal_width()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 11:58:20 +02:00
Petr Uzel 597cfec51f blkid: use get_terminal_width() from ttyutils.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:56 +02:00
Petr Uzel f80e9bc30a libuuid: move read_all to include/all-io.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:36 +02:00
Petr Uzel e12c9866b5 include: rename writeall.h to all-io.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:27 +02:00
Petr Uzel 68eebd5354 lsblk: improve man page wording
Cc: Regid Ichira <regid23@yahoo.com>
From: Regid Ichira <regid23@yahoo.com>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672702
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:19:44 +02:00
Jeremy Huntwork 1c935e725e Remove use of __P. Its intended usage was to support pre-ANSI C compilers, but that is not even possible with the modern-day codebase. Moreover, it breaks compiling on libcs that do not define this legacy implementation-internal macro. 2012-05-13 16:32:51 +00:00
Petr Uzel c544aa2c25 libuuid: avoid double open and leaking fd (reworked)
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>
2012-05-10 11:43:49 +02:00
Davidlohr Bueso fbf9034e48 lslocks: fix bracket indentation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-05-10 11:41:15 +02:00
Karel Zak 4b1cf29d23 uuidd: remove unnecessary variables
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-04 16:20:37 +02:00
Petr Uzel 6126f7a53c libuuid: avoid double open and leaking descriptor
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>
2012-05-04 15:14:24 +02:00
Petr Uzel 881a0f6b28 uuidd: introduce uuidd_cxt to pass arguments to server loop
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:14:21 +02:00
Petr Uzel 1b68c37927 uuidd: add systemd unit files
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>
2012-05-04 15:14:16 +02:00
Petr Uzel cb20279fb0 uuidd: do not drop privileges
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>
2012-05-04 15:14:11 +02:00
Petr Uzel 18c68d70ee uuidd: print all debugging information to stderr
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:14:07 +02:00
Petr Uzel bbe289c489 uuidd: implement --socket-activation option
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>
2012-05-04 15:14:04 +02:00
Petr Uzel 75a94e8b36 uuidd: factor out socket creation into separate function
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:46 +02:00
Petr Uzel e1cf3ebed5 uuidd: implement --no-fork option
With this option, uuidd does not daemonize itself but stays
in the foreground.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:45 +02:00
Petr Uzel f6f3dc7811 uuidd: use ignore_result helper
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:43 +02:00
Petr Uzel 0abfbd9ce6 uuidd: implement --no-pid option
With this option, uuidd does not create the PID file.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:40 +02:00
Petr Uzel c453635572 uuidd: factor out pidfile creation into separate function
Introduce create_pidfile() function.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:34 +02:00
Petr Uzel fcb09bf211 uuidd: remove useless initialization of cleanup_socket
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:28 +02:00
Petr Uzel 2e9b39eff3 uuidd: use UUIDD_OP_GETPID instead of magic number
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>
2012-05-04 15:13:20 +02:00
Karel Zak 1ea962b208 lsblk: fix /sys/.../ro usage
Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-03 16:24:12 +02:00
Karel Zak 0bda832322 lslock: remove duplicate variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-03 16:01:04 +02:00
Karel Zak 4bfd4bffb7 findmnt: restrict within-device matching
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-27 14:06:20 +02:00
Petr Uzel 6901f22ce0 findmnt: fix compiler warnings [-Wuninitialized]
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>
2012-04-27 12:30:51 +02:00
Dave Reisner b215d8e9a7 findmnt: add match_by_file to do within-device matching
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>
2012-04-26 09:38:07 +02:00
Karel Zak d324270eee lsblk: remove private \x<hex> coding, decode data from udev
* remove private encoding code (all encoding will be in lib/tt.c)
 * decode LABELs from udev

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-26 09:20:47 +02:00
Karel Zak 4644638fe8 findmnt: add note about \x<hex> to man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-26 09:19:07 +02:00
Karel Zak cd49218679 findmnt: add support for maj:min source
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-25 09:51:26 +02:00