]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
13 years agobuild-sys: add randutils.h to dist
Petr Uzel [Tue, 24 Apr 2012 08:20:54 +0000 (10:20 +0200)] 
build-sys: add randutils.h to dist

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agobuild-sys: run distcheck with verbose make rules
Petr Uzel [Tue, 24 Apr 2012 08:20:53 +0000 (10:20 +0200)] 
build-sys: run distcheck with verbose make rules

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agolibmount: close device fd (to avoid mount(2) EBUSY)
Karel Zak [Fri, 27 Apr 2012 08:30:08 +0000 (10:30 +0200)] 
libmount: close device fd (to avoid mount(2) EBUSY)

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>
13 years agofindmnt: add match_by_file to do within-device matching
Dave Reisner [Thu, 26 Apr 2012 00:30:52 +0000 (20:30 -0400)] 
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>
13 years agolibmount: expose mnt_get_mountpoint as external API
Dave Reisner [Thu, 26 Apr 2012 00:30:51 +0000 (20:30 -0400)] 
libmount: expose mnt_get_mountpoint as external API

13 years agolib/tt: check for non-printable chars for raw/export format
Karel Zak [Thu, 26 Apr 2012 07:28:44 +0000 (09:28 +0200)] 
lib/tt: check for non-printable chars for raw/export format

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib/tt: encode data for RAW and EXPORT format
Karel Zak [Thu, 26 Apr 2012 07:22:19 +0000 (09:22 +0200)] 
lib/tt: encode data for RAW and EXPORT format

 * 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>
13 years agolsblk: remove private \x<hex> coding, decode data from udev
Karel Zak [Thu, 26 Apr 2012 07:19:36 +0000 (09:19 +0200)] 
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>
13 years agofindmnt: add note about \x<hex> to man page
Karel Zak [Thu, 26 Apr 2012 07:19:07 +0000 (09:19 +0200)] 
findmnt: add note about \x<hex> to man page

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib/mangle: cleanup, add unhexmangle
Karel Zak [Thu, 26 Apr 2012 07:17:44 +0000 (09:17 +0200)] 
lib/mangle: cleanup, add unhexmangle

 * use strchr() rather than for()
 * small refactoring in mangle code
 * add un-hex-mangle

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofindmnt: add support for maj:min source
Karel Zak [Wed, 25 Apr 2012 07:51:26 +0000 (09:51 +0200)] 
findmnt: add support for maj:min source

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add mnt_table_find_devno()
Karel Zak [Wed, 25 Apr 2012 07:49:50 +0000 (09:49 +0200)] 
libmount: add mnt_table_find_devno()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: fix mnt_context_guess_fstype()
Karel Zak [Wed, 25 Apr 2012 07:05:24 +0000 (09:05 +0200)] 
libmount: fix mnt_context_guess_fstype()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (new) use MNT_ERR_ for error messages
Karel Zak [Tue, 24 Apr 2012 09:59:18 +0000 (11:59 +0200)] 
mount: (new) use MNT_ERR_ for error messages

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add special MNT_ERR_ codes
Karel Zak [Tue, 24 Apr 2012 09:57:32 +0000 (11:57 +0200)] 
libmount: add special MNT_ERR_ codes

... to detect some situations where standard -errno is too generic.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: fix mount by pattern
Karel Zak [Tue, 24 Apr 2012 09:52:04 +0000 (11:52 +0200)] 
libmount: fix mount by pattern

  mount /foo /bar

without entry in /etc/fstab the mount command tries all filesystems
from /{etc,proc}/filesystems. We should NOT call mount(2) more then
once if the syscall returns for example ENOENT, acceptable is only
EINVAL.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolscpu: fix possibly undefined operation
Petr Uzel [Mon, 23 Apr 2012 08:43:38 +0000 (10:43 +0200)] 
lscpu: fix possibly undefined operation

With -Wall -Werror, compilation of lscpu.c fails with:

  Making all in sys-utils
  make[2]: Entering directory `/home/petr/upstream/util-linux/sys-utils'
  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..  -include ../config.h -I../include -DLOCALEDIR=\"/usr/share/locale\"  -fsigned-char -Wall -Werror -MT lscpu.o -MD -MP -MF .deps/lscpu.Tpo -c -o lscpu.o lscpu.c
  lscpu.c: In function ‘print_parsable’:
  lscpu.c:971:7: error: operation on ‘p’ may be undefined [-Werror=sequence-point]
  cc1: all warnings being treated as errors

Fix by splitting the pointer increment to separate statement.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agolibblkid: befs: declare functions static
Petr Uzel [Sun, 22 Apr 2012 14:16:39 +0000 (16:16 +0200)] 
libblkid: befs: declare functions static

Since commit 0b0c231f64d02e682
(swapon: move generic code to swapon-common.c), if util-linux is
configured with --enable-static --disable-shared --enable-libmount-mount
options, the build fails with the following error:

  ...
  libtool: link: gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2 -o switch_root switch_root.o
  /home/petr/upstream/util-linux/libblkid/src/.libs/libblkid.a(befs.o): In function `get_uuid':
  /home/petr/upstream/util-linux/libblkid/src/superblocks/befs.c:333: multiple definition of `get_uuid'
  swapon-swapon-common.o:/home/petr/upstream/util-linux/sys-utils/swapon-common.c:99: first defined here
  collect2: ld returned 1 exit status
  /bin/sh ../libtool  --tag=CC   --mode=link gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2   -o flock flock.o strutils.o
  libtool: link: gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2 -o pivot_root pivot_root.o
  make[2]: *** [swapon] Error 1
  make[2]: *** Waiting for unfinished jobs....
  /home/petr/upstream/util-linux/libblkid/src/.libs/libblkid.a(befs.o): In function `get_uuid':
  /home/petr/upstream/util-linux/libblkid/src/superblocks/befs.c:333: multiple definition of `get_uuid'
  swapoff-swapon-common.o:/home/petr/upstream/util-linux/sys-utils/swapon-common.c:99: first defined here

Fix by declaring befs funcitons static.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosys-utils: avoid duplicate reference to fstab.5
Dave Reisner [Sun, 22 Apr 2012 01:44:32 +0000 (21:44 -0400)] 
sys-utils: avoid duplicate reference to fstab.5

This is no longer in sys-utils/ anyways, and its unconditionally
distributed by an earlier dist_man_MANS declare in the Makefile.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agologin: use get_fd_tabsize()
Karel Zak [Mon, 23 Apr 2012 12:00:29 +0000 (14:00 +0200)] 
login: use get_fd_tabsize()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibuuid: use get_fd_tabsize()
Karel Zak [Mon, 23 Apr 2012 12:00:18 +0000 (14:00 +0200)] 
libuuid: use get_fd_tabsize()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib/fileutils: add get_fd_tabsize()
Karel Zak [Mon, 23 Apr 2012 11:52:41 +0000 (13:52 +0200)] 
lib/fileutils: add get_fd_tabsize()

as a fallback for the function getdtablesize()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agologin: use getdtablesize() correctly in login.c
chas williams - CONTRACTOR [Fri, 20 Apr 2012 14:58:28 +0000 (10:58 -0400)] 
login: use getdtablesize() correctly in login.c

getdtablesize() is the number of descriptors and since decriptors start
at 0, its value isnt the largest descriptors possible.  One should use
getdtablesize() - 1 instead.

Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
13 years agoFix typos found by misspellings
Bernhard Voelker [Thu, 19 Apr 2012 22:10:44 +0000 (00:10 +0200)] 
Fix typos found by misspellings

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>
13 years agofdisk: simplify device opening
Davidlohr Bueso [Mon, 23 Apr 2012 11:07:16 +0000 (13:07 +0200)] 
fdisk: simplify device opening

This patch makes fdisk open(2) the device in only one place (get_boot), instead
of having to depend on user input (ie: listing -l).

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: remove action enum
Davidlohr Bueso [Mon, 23 Apr 2012 11:00:00 +0000 (13:00 +0200)] 
fdisk: remove action enum

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: do not call sgi and sun code when creating a new dos label
Davidlohr Bueso [Mon, 23 Apr 2012 10:55:52 +0000 (12:55 +0200)] 
fdisk: do not call sgi and sun code when creating a new dos label

When creating a new DOS label, SGI and SUN pt logic have no business being
there. Remove sun/sgi_nolabel(), since the default amount of partitions are
previously set to 4 and the sun/sgi magic nums are not used in this context.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agosfdisk: improve F_MEGABYTE header
Bernhard Voelker [Wed, 18 Apr 2012 06:47:29 +0000 (08:47 +0200)] 
sfdisk: improve F_MEGABYTE header

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
13 years agofdisk: remove dead code
Davidlohr Bueso [Mon, 23 Apr 2012 10:40:20 +0000 (12:40 +0200)] 
fdisk: remove dead code

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: kernel/bios sectors and heads need not be global
Davidlohr Bueso [Mon, 23 Apr 2012 10:38:22 +0000 (12:38 +0200)] 
fdisk: kernel/bios sectors and heads need not be global

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: standarize version output
Davidlohr Bueso [Mon, 23 Apr 2012 10:15:15 +0000 (12:15 +0200)] 
fdisk: standarize version output

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: make CHS user values more robust
Davidlohr Bueso [Mon, 23 Apr 2012 10:12:32 +0000 (12:12 +0200)] 
fdisk: make CHS user values more robust

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agoprlimit: remove bogus instructions
Davidlohr Bueso [Mon, 23 Apr 2012 10:05:25 +0000 (12:05 +0200)] 
prlimit: remove bogus instructions

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agoeject: verify writing to streams was successful
Sami Kerola [Wed, 11 Apr 2012 18:41:56 +0000 (20:41 +0200)] 
eject: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agolib/pager: fix compiler warnings
Karel Zak [Mon, 23 Apr 2012 09:57:50 +0000 (11:57 +0200)] 
lib/pager: fix compiler warnings

pager.c: In function ‘start_command’:
pager.c:82:7: warning: unused variable ‘err’ [-Wunused-variable]
pager.c:49:25: warning: unused variable ‘fderr’ [-Wunused-variable]
pager.c:49:15: warning: unused variable ‘fdout’ [-Wunused-variable]
pager.c:48:25: warning: unused variable ‘need_err’ [-Wunused-variable]
pager.c:48:15: warning: unused variable ‘need_out’ [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib: add pager functionality
Davidlohr Bueso [Mon, 23 Apr 2012 09:51:29 +0000 (11:51 +0200)] 
lib: add pager functionality

When some program' output exceeds the terminal's dimensions, it is a nice
feature to call a pager that acts as calling 'less' to allow better user
navigation. This patch adds this functionality, based on what perf and git
have (ie: git log).

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agonamei: fix relative symlinks evaluation
Karel Zak [Fri, 20 Apr 2012 13:06:57 +0000 (15:06 +0200)] 
namei: fix relative symlinks evaluation

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>
13 years agodocs: move fstab.5 to sys-utils (mount/ dir is deprecated)
Karel Zak [Thu, 19 Apr 2012 12:48:40 +0000 (14:48 +0200)] 
docs: move fstab.5 to sys-utils (mount/ dir is deprecated)

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:40:22 +0000 (14:40 +0200)] 
swapon: add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (new) add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:40:06 +0000 (14:40 +0200)] 
mount: (new) add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolsblk: add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:39:44 +0000 (14:39 +0200)] 
lsblk: add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agofindmnt: add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:38:53 +0000 (14:38 +0200)] 
findmnt: add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoblkid: add docs about PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:34:29 +0000 (14:34 +0200)] 
blkid: add docs about PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:33:59 +0000 (14:33 +0200)] 
libmount: add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibblkid: add support for PARTUUID= and PARTLABEL=
Karel Zak [Thu, 19 Apr 2012 12:33:49 +0000 (14:33 +0200)] 
libblkid: add support for PARTUUID= and PARTLABEL=

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agotests: tiny change in output header
Karel Zak [Wed, 18 Apr 2012 11:14:43 +0000 (13:14 +0200)] 
tests: tiny change in output header

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agotests: remove LD_LIBRARY_PATH from swapon tests
Karel Zak [Wed, 18 Apr 2012 11:05:55 +0000 (13:05 +0200)] 
tests: remove LD_LIBRARY_PATH from swapon tests

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: minor coding style changes
Karel Zak [Wed, 18 Apr 2012 10:58:15 +0000 (12:58 +0200)] 
swapon: minor coding style changes

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: cleanup usage()
Karel Zak [Wed, 18 Apr 2012 10:52:13 +0000 (12:52 +0200)] 
swapon: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: cleanup main()
Karel Zak [Wed, 18 Apr 2012 10:44:14 +0000 (12:44 +0200)] 
swapon: cleanup main()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapoff: cleanup usage() and includes
Karel Zak [Wed, 18 Apr 2012 10:38:03 +0000 (12:38 +0200)] 
swapoff: cleanup usage() and includes

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: fix man page typo s/reatime/relatime/
Karel Zak [Wed, 18 Apr 2012 10:25:28 +0000 (12:25 +0200)] 
mount: fix man page typo s/reatime/relatime/

Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapoff: use libmount to parse fstab
Karel Zak [Wed, 18 Apr 2012 10:22:11 +0000 (12:22 +0200)] 
swapoff: use libmount to parse fstab

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapoff: move code from swapon.c to swapoff.c
Karel Zak [Wed, 18 Apr 2012 09:43:42 +0000 (11:43 +0200)] 
swapoff: move code from swapon.c to swapoff.c

 * multipurpose binaries (symlinks) suck when used with autotools
 * swapoff shares small subset of the code with swapon
 * usage() and 'struct option' is unnecessary complex when shared
 * shorter and simple code is easer to maintain...

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: move generic code to swapon-common.c
Karel Zak [Wed, 18 Apr 2012 09:21:12 +0000 (11:21 +0200)] 
swapon: move generic code to swapon-common.c

This will allow to use separate binary for swapon and swapoff.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: use libmount for fstab parsing (for swapon --all)
Karel Zak [Wed, 18 Apr 2012 08:14:44 +0000 (10:14 +0200)] 
swapon: use libmount for fstab parsing (for swapon --all)

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (new) be more pedantic about --make-*
Karel Zak [Wed, 18 Apr 2012 08:09:49 +0000 (10:09 +0200)] 
mount: (new) be more pedantic about --make-*

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add mnt_context_get_options()
Karel Zak [Wed, 18 Apr 2012 08:06:35 +0000 (10:06 +0200)] 
libmount: add mnt_context_get_options()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: use only libmount for paths/tags evealuation
Karel Zak [Tue, 17 Apr 2012 11:05:04 +0000 (13:05 +0200)] 
swapon: use only libmount for paths/tags evealuation

libmount provides very simple API for paths and tags canonicalizations,
let's use it, rather directly link to libblkid and lib/canonicalize.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoswapon: use libmount for /proc/swaps parsing
Karel Zak [Tue, 17 Apr 2012 10:49:11 +0000 (12:49 +0200)] 
swapon: use libmount for /proc/swaps parsing

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: (new) improve error messages
Karel Zak [Tue, 17 Apr 2012 09:36:36 +0000 (11:36 +0200)] 
mount: (new) improve error messages

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add mnt_context_fstab_applied()
Karel Zak [Tue, 17 Apr 2012 09:36:32 +0000 (11:36 +0200)] 
libmount: add mnt_context_fstab_applied()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agowdctl: add watchdog status tool
Lennart Poettering [Thu, 5 Apr 2012 21:31:41 +0000 (23:31 +0200)] 
wdctl: add watchdog status tool

For: util-linux

This patch adds a tiny tool "wdctl" which may be used to query the
status of Linux watchdog devices (/dev/watchdog).

This will simply query all fields that may be queried from the
device and print them nicely formatted.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
13 years agocal: Fix building under uClibc.
James Le Cuirot [Mon, 16 Apr 2012 10:05:27 +0000 (11:05 +0100)] 
cal: Fix building under uClibc.

Commit fbc333fec09394bf4e47707de08a65e8c0e9c288 broke building under uClibc because HAVE_DECL macros are set to 0, not undefined.

Signed-off-by: James Le Cuirot <chewi@aura-online.co.uk>
13 years agofdisk: remove unused file
Karel Zak [Wed, 11 Apr 2012 10:55:51 +0000 (12:55 +0200)] 
fdisk: remove unused file

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agologin-utils: add missing header, fix setpwnam.c fclose logic
Karel Zak [Wed, 11 Apr 2012 10:52:36 +0000 (12:52 +0200)] 
login-utils: add missing header, fix setpwnam.c fclose logic

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Wed, 11 Apr 2012 10:37:59 +0000 (12:37 +0200)] 
Merge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit

* 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit:
  disk-utils: verify writing to streams was successful
  fdisk: verify writing to streams was successful
  getopt: verify writing to streams was successful
  hwclock: verify writing to streams was successful
  login-utils: verify writing to streams was successful
  misc-utils: verify writing to streams was successful
  mount: verify writing to streams was successful
  partx: verify writing to streams was successful
  schedutils: verify writing to streams was successful
  sys-utils: verify writing to streams was successful
  term-utils: verify writing to streams was successful
  text-utils: verify writing to streams was successful
  include: add stream error checking facility

Conflicts:
fdisk/fdisk.c

13 years agolibuuid: use randutils
Davidlohr Bueso [Thu, 5 Apr 2012 21:52:10 +0000 (23:52 +0200)] 
libuuid: use randutils

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofdisk: use randutils for mbr signature creation
Davidlohr Bueso [Thu, 5 Apr 2012 21:52:07 +0000 (23:52 +0200)] 
fdisk: use randutils for mbr signature creation

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agolib: random utilities
Davidlohr Bueso [Thu, 5 Apr 2012 21:52:04 +0000 (23:52 +0200)] 
lib: random utilities

Add a random number(s) generator specific file. The intial functions are based
on what libuuid provide. I did some modifications like avoid WIN32 checks - this
is util-LINUX.

[kzak@redhat.com: - move jrand_seed to lib/randutils.c
                  - use TLS for jrand_seed (like original code from libuuid)
                  - use size_t for buffer sizes
                  - add close() to random_get_bytes]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib/blkdev: fix compiler warning [-Wreturn-type]
Karel Zak [Tue, 10 Apr 2012 10:29:10 +0000 (12:29 +0200)] 
lib/blkdev: fix compiler warning [-Wreturn-type]

../lib/blkdev.c: In function ‘blkdev_get_geometry’:
../lib/blkdev.c:287:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agosfdisk: fix calculation due to type mismatch (ix86)
Petr Uzel [Fri, 6 Apr 2012 14:53:13 +0000 (16:53 +0200)] 
sfdisk: fix calculation due to type mismatch (ix86)

Instructing sfdisk to create one partition spanning
across entire disk (",,") on 32bit system, if the disk
is sufficiently large (~2TB) leads to wrong calculation
in compute_start_sect() due to type mismatch.

Can be reproduced as:

--------------------------
linux-3ln5:~ # modprobe scsi_debug virtual_gb=2000
linux-3ln5:~ # sfdisk /dev/sda <<< ',,'
Checking that no-one is using this disk right now ...
OK

Disk /dev/sda: 261083 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
sfdisk:  /dev/sda: unrecognized partition table type

Old situation:
sfdisk: No partitions found

no room for partition descriptor
sfdisk: bad input
--------------------------

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agodocs: eject.1: align with Documentation/howto-man-page.txt
Sami Kerola [Thu, 5 Apr 2012 20:40:49 +0000 (22:40 +0200)] 
docs: eject.1: align with Documentation/howto-man-page.txt

* Add spaces after dots (English spacing).
* Add line break macros.
* Use URL and email macros where appropriate.
* Fix typo at the end of the manual (s/lsblk/eject/).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoeject: close open file [cppcheck]
Sami Kerola [Thu, 5 Apr 2012 20:40:48 +0000 (22:40 +0200)] 
eject: close open file [cppcheck]

[eject.c:498]: (error) Resource leak: f

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoeject: inform why open failed
Sami Kerola [Thu, 5 Apr 2012 20:40:47 +0000 (22:40 +0200)] 
eject: inform why open failed

Mostly to cover common case when user does not have permission to use
eject.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agostrutils: return success on test program
Davidlohr Bueso [Thu, 5 Apr 2012 20:35:19 +0000 (22:35 +0200)] 
strutils: return success on test program

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agoeject: use CDROM_DRIVE_STATUS if available for tray toggling
Mike Frysinger [Thu, 5 Apr 2012 15:50:46 +0000 (11:50 -0400)] 
eject: use CDROM_DRIVE_STATUS if available for tray toggling

One some platforms, the -T option can be unreliable (see reference bug
report for some examples).  Instead, if the kernel supports the cdrom
status ioctl, use that to ask explicitly for the current tray status
and then open/close accordingly.

The eject_cdrom() func was reworked slightly, but none of the existing
callers care about the explicit normalization to [0,1] values, so have
it return the raw value so we can convert toggle_tray() over to using
that.

Finally, now that toggle_tray() uses a lot of helper functions, drop
the check on CDROMCLOSETRAY.  The sub-functions take care of that.

Reference: https://bugs.gentoo.org/261880
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoeject(1): fix typo in mount(1) reference
Mike Frysinger [Thu, 5 Apr 2012 15:50:45 +0000 (11:50 -0400)] 
eject(1): fix typo in mount(1) reference

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoeject: constify array
Mike Frysinger [Thu, 5 Apr 2012 15:50:44 +0000 (11:50 -0400)] 
eject: constify array

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agofdisk: move kernel geometry into blkdev
Davidlohr Bueso [Wed, 4 Apr 2012 17:01:24 +0000 (19:01 +0200)] 
fdisk: move kernel geometry into blkdev

This is a more generic place for this ioctl.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agofsck: don't free fstab table on parse failure
Dave Reisner [Tue, 27 Mar 2012 12:53:58 +0000 (08:53 -0400)] 
fsck: don't free fstab table on parse failure

Even if we fail parsing, fstab gets referenced later in the code (and
will subsequently crash via heap corruption). Take the easy way out and
simply avoid deallocating this table, as it will be freed for us on
program exit regardless.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agosfdisk: make -l less verbose about missing PT
Karel Zak [Fri, 6 Apr 2012 08:12:32 +0000 (10:12 +0200)] 
sfdisk: make -l less verbose about missing PT

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch 'eject'
Karel Zak [Thu, 5 Apr 2012 13:58:02 +0000 (15:58 +0200)] 
Merge branch 'eject'

* eject: (47 commits)
  tests: use eject --force
  eject: use BUILD_EJECT, move to sys-utils
  eject: clean up usage()
  eject: clean up man page
  eject: add --force option
  eject: check for hotplug/removable attribute
  eject: remove obsolete code, use EXIT_* macros
  tests: add umount-by-eject tests
  eject: improve work with partitioned devices
  lib/sysfs: improve sysfs_is_partition_dirent()
  eject: call umount <mountpoint> rather than <device>
  eject: use libmount to detect if cdrom is mounted
  eject: make the code robust
  eject: use SG_IO ioctl for scsi
  eject: support CDIOCEJECT ioctl
  eject: new close_tray code from Fedora
  eject: new auto_eject code from Fedora
  eject: add -X from Fedora
  eject: add --manualeject from fedora
  eject: clean up devname usage
  ...

13 years agotests: use eject --force
Karel Zak [Thu, 5 Apr 2012 13:57:12 +0000 (15:57 +0200)] 
tests: use eject --force

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: use BUILD_EJECT, move to sys-utils
Karel Zak [Thu, 5 Apr 2012 13:39:44 +0000 (15:39 +0200)] 
eject: use BUILD_EJECT, move to sys-utils

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: clean up usage()
Karel Zak [Thu, 5 Apr 2012 11:21:09 +0000 (13:21 +0200)] 
eject: clean up usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: clean up man page
Karel Zak [Thu, 5 Apr 2012 11:12:16 +0000 (13:12 +0200)] 
eject: clean up man page

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: add --force option
Karel Zak [Thu, 5 Apr 2012 10:24:20 +0000 (12:24 +0200)] 
eject: add --force option

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoeject: check for hotplug/removable attribute
Karel Zak [Thu, 5 Apr 2012 10:06:23 +0000 (12:06 +0200)] 
eject: check for hotplug/removable attribute

 * based on code from Fedora

 * supported are only:

   - /sys/dev/block/<maj:min>/removable devices
   - devices connected by usb, ieee1394, pcmcia, mmc or ccw subsystem.

Frankly, this heuristic sucks -- all is hot-pluggable in this days,
but it's probably good idea to restrict the default behavior to avoid
user's mistakes.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agodisk-utils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 18:04:39 +0000 (20:04 +0200)] 
disk-utils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agofdisk: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 18:02:04 +0000 (20:02 +0200)] 
fdisk: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agogetopt: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 18:01:07 +0000 (20:01 +0200)] 
getopt: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agohwclock: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:59:35 +0000 (19:59 +0200)] 
hwclock: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agologin-utils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:58:34 +0000 (19:58 +0200)] 
login-utils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agomisc-utils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:56:48 +0000 (19:56 +0200)] 
misc-utils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agomount: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:54:15 +0000 (19:54 +0200)] 
mount: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agopartx: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:53:13 +0000 (19:53 +0200)] 
partx: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoschedutils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:51:32 +0000 (19:51 +0200)] 
schedutils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agosys-utils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:49:40 +0000 (19:49 +0200)] 
sys-utils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoterm-utils: verify writing to streams was successful
Sami Kerola [Wed, 4 Apr 2012 17:44:04 +0000 (19:44 +0200)] 
term-utils: verify writing to streams was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>