summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* disk-utils: cleanup strtoxx_or_err()Karel Zak2012-05-153-30/+17Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: create type specific strtoxx_or_err()Karel Zak2012-05-152-23/+86
| | | | | | | We need [un]signed int ([u]int32_t) on many places. It's also more readable and robust to use uintXX_t types than for example "long long". Signed-off-by: Karel Zak <kzak@redhat.com>
* include/ttyutils: more robust get_terminal_width()Karel Zak2012-05-152-4/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: use get_terminal_width() from ttyutils.hPetr Uzel2012-05-151-28/+1Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* include: move get_terminal_width() to ttyutils.hPetr Uzel2012-05-152-27/+30
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libuuid: move read_all to include/all-io.hPetr Uzel2012-05-153-49/+26Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-1514-16/+16
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* lib/mangle: check for end of string on every iterationDave Reisner2012-05-151-4/+5
| | | | | | | | | Checking for the null byte at the end of the string only conditionally leads to segfaults, evidenced by mount helpers crashing on writes to /run/mount/utab. Simply check for the null on each iteration, and append a null byte to the mangled string before breaking. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* rev: mention tac(1) in 'SEE ALSO' man page sectionPetr Uzel2012-05-151-0/+2
| | | | | | | Cc: James R. Van Zandt <jrv@debian.org> From: James R. Van Zandt <jrv@debian.org> Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568709 Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mkswap: improve diagnostics message if the device is mountedPetr Uzel2012-05-151-4/+5
| | | | | | | | Currently, attempt to create swap on mounted partition results with "/dev/sdXy: Device or resource busy" message being printed. Change this to explicitly telling the user that the device is mounted. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mkswap: allow creating swap on /dev/hd[ab]Petr Uzel2012-05-151-5/+0Star
| | | | | | | | | | Currently, mkswap does not allow swap to be created on /dev/hda and /dev/hdb. There is no reason why /dev/hda and /dev/hdb should be treated differently. Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=491021 Cc: Russell Coker <russell@coker.com.au> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* mkswap: use is_mounted() instead of check_mount()Petr Uzel2012-05-152-24/+3Star
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* lsblk: improve man page wordingPetr Uzel2012-05-151-2/+2
| | | | | | | 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>
* tests: update fdisk testKarel Zak2012-05-101-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: avoid double open and leaking fd (reworked)Petr Uzel2012-05-106-20/+26
| | | | | | | | | | | | | | 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>
* lslocks: fix bracket indentationDavidlohr Bueso2012-05-101-1/+1
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: sgi: abort on HDIO_GETGEO failureDavidlohr Bueso2012-05-101-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | When the HDIO_GETGEO ioctl fails on non IRIX/MIPS platforms (ie: inappropriate ioctl for device) the variables that describe the geometry are compromissed. One clear example is a division by 0 bug because the cylinder size is 0 is verify_sgi(): $> fdisk sgi.img Welcome to fdisk (util-linux 2.21.392-4b1c). ... Command (m for help): x Expert command (m for help): g Building a new SGI disklabel. Partition 11 of type SGI volume and of size 7.9 MiB is set Floating point exception Fix this by simply exiting the program instead of leaving it in a vulnerable state. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: remove unused function declarationDavidlohr Bueso2012-05-101-2/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: create DOS specific write table functionDavidlohr Bueso2012-05-103-23/+30
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: move DOS new/add partition codeDavidlohr Bueso2012-05-104-348/+365
| | | | | | | | | | | Since this is DOS specific logic, it belongs in its own label file. Additionally, a dos_new_partition() function is created that asks the user for partition type and then calls the actual dos_add_partition(). This patch passed fdisk regression tests, builds without problems and it was locally tested against adding and removing DOS partitions. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: remove unused hsc2sector macroDavidlohr Bueso2012-05-101-2/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* fdisk: fix segfault on bsd labelDavidlohr Bueso2012-05-103-1/+4
| | | | | | | | | | | | | | | | | | Commit 8db8295d824cd0c8cba9385e4635d6e311d69d3f added a regression that causes the program to crash when touching the partition structure (pte) for BSD/OSF labels. Since DOS has its own initialization function, allow BSD labels to use it as well. Steps to reproduce: $> fdisk bsd.img (obtained from blkid regression test files) Command (m for help): p ... I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Segmentation fault Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* 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-046-15/+20
| | | | | | | | | | | | | 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>
* libuuid: don't exec uuiddPetr Uzel2012-05-042-46/+3Star
| | | | | | | | | | 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>
* uuidd: add systemd unit filesPetr Uzel2012-05-046-3/+40
| | | | | | | | 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: use EXIT_FAILUREPetr Uzel2012-05-041-1/+1
| | | | 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-046-44/+926
| | | | | | | | | | | | | | 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-042-6/+15
| | | | | | | 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-042-12/+39
| | | | | | 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>
* uuidd: use UUIDD_OP_GETPID instead of magic numberPetr Uzel2012-05-041-2/+2
| | | | | | | | | 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: support UFS UUIDVladimir 'φ-coder/phcoder' Serbinenko2012-05-041-0/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: accept small blocks for NTFS and Reiserfs in blkidVladimir 'φ-coder/phcoder' Serbinenko2012-05-042-4/+4
| | | | | | | | | 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>
* build-sys: add BUILD_WDCTL, check for linux/watchdog.hKarel Zak2012-05-042-0/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: add man pageKarel Zak2012-05-042-0/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: make timeouts output more parsableKarel Zak2012-05-041-33/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: rewrite to use lib/ttKarel Zak2012-05-032-93/+373
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: add string_to_bitmask()Karel Zak2012-05-032-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: fix /sys/.../ro usageKarel Zak2012-05-031-1/+1
| | | | | Reported-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lslock: remove duplicate variableKarel Zak2012-05-031-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/tt: remove obsolete stuffKarel Zak2012-05-032-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: align with other util-linux commandsSami Kerola2012-05-032-3/+9
| | | | | | | | | * Add watchdog device path to pathnames.h * Check output stream status at exit. * Adjust usage() notation to follow howto file. * Retire numeric return value. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: fix fdiskdoslabel.c global variablesKarel Zak2012-05-024-18/+25
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>