]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
11 years agocal: don't mix ncurses output functions and printf()
Karel Zak [Thu, 17 Jan 2013 17:48:16 +0000 (18:48 +0100)] 
cal: don't mix ncurses output functions and printf()

Fedora 18 (ncurses-libs-5.9-7.20121017, glibc-2.16-28):

$ cal | cat
Actual results:
    January 2013    Su Mo Tu We Th Fr Sa       1  2  3  4  5 6  7  8
9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31

Not sure where is the problem, but it's too fragile to mix two
output methods in one code.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=896447
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agonsenter: improve optional args in usage() and man page
Karel Zak [Thu, 17 Jan 2013 12:30:33 +0000 (13:30 +0100)] 
nsenter: improve optional args in usage() and man page

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agounshare,nsenter: Move the old libc handling into a common header namespace.h
Eric W. Biederman [Thu, 17 Jan 2013 00:36:32 +0000 (16:36 -0800)] 
unshare,nsenter: Move the old libc handling into a common header namespace.h

Move the defitions of CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC,
CLONE_NEWNET, CLONE_NEWUSER, CLONE_NEWPID into namespace.h in case
sched.h does not provide those definitions.  Are there systems
around that are old enough that still need this?

Move the definitions of unshare() and setns() into namespace.h
for supporting old versions of libc that does not provice these.
I have tested this support with setns as I still have systems
old enough that glibc does not wrap setns.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonsenter: Replace a bare strtoul with strtoul_or_err
Eric W. Biederman [Thu, 17 Jan 2013 00:35:53 +0000 (16:35 -0800)] 
nsenter: Replace a bare strtoul with strtoul_or_err

This is shorter code and makes things a bit clearer and less
error prone if anyone happens to copy the code.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonsenter: Add const to declarations where possible.
Eric W. Biederman [Thu, 17 Jan 2013 00:35:12 +0000 (16:35 -0800)] 
nsenter: Add const to declarations where possible.

Make it clear where functions do not modify their arguments.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonsenter: Properly spell significant in a comment.
Eric W. Biederman [Thu, 17 Jan 2013 00:34:44 +0000 (16:34 -0800)] 
nsenter: Properly spell significant in a comment.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonsenter: Enhance waiting for a child process
Eric W. Biederman [Thu, 17 Jan 2013 00:34:17 +0000 (16:34 -0800)] 
nsenter: Enhance waiting for a child process

In the case of a pid namespace we need to fork a child process instead
of calling exec.  Move all of that logic out of line into a function
continue_as_child, making the logic of the primary case easier to
understand.

Update the logic for waiting for a child process to suspend ourselves
when the child processes suspends and to continue the child process
when we are unsuspsended.  This supports the bash suspend command and
various editors that suspend themselves.

If the child process exits with a signal update the logic to run
kill(getpid(), WTERMSIG(status)) so the caller sees the same exit code
that nsenter observed.

There will always be permission to send signals to our children and
the tty is not changing so there is no need for the intermediate
process to forward signals to it's child.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agounshare: Add support for the pid and user namespaces
Eric W. Biederman [Fri, 11 Jan 2013 22:53:34 +0000 (14:53 -0800)] 
unshare: Add support for the pid and user namespaces

- Update the unshare application to support the pid and user namespaces.
- Update the man page for the new options
- Fix typo in the man page where UTS was spelled UTC.
- Remove the vestigal support for running a suid unshare.
  After unsharing a user namespace setuid(getuid()) won't work because
  no uid or gid mappings have been specified yet. So it is just easier not
  to have any support for running suid.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agonsenter: new command (light wrapper around setns)
Eric W. Biederman [Fri, 11 Jan 2013 22:46:38 +0000 (14:46 -0800)] 
nsenter: new command (light wrapper around setns)

Inspired by unshare, nsenter is a simple wrapper around setns that
allows running a new process in the context of an existing process.

Full paths may be specified to the namespace arguments so that
namespace file descriptors may be used wherever they reside in the
filesystem.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
11 years agoRevert "unshare: support the switching of namespaces"
Karel Zak [Thu, 17 Jan 2013 12:00:44 +0000 (13:00 +0100)] 
Revert "unshare: support the switching of namespaces"

The functionality will be replaced with nsenter from Eric W.
Biederman.

This reverts commit 4bbe8099390d528018890efa914e268de3c4b44b.

11 years agofindmnt: use tree output in more cases
Karel Zak [Thu, 17 Jan 2013 11:02:03 +0000 (12:02 +0100)] 
findmnt: use tree output in more cases

It seems that we can create the tree also if output is restricted by
fstype or options filter, for example

$ findmnt -t cgroups

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: make --verbose more verbose about propagation
Karel Zak [Tue, 15 Jan 2013 15:09:07 +0000 (16:09 +0100)] 
mount: make --verbose more verbose about propagation

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: keep MS_PROPAGATION flags in mnt_context_set_mflags() result
Karel Zak [Tue, 15 Jan 2013 15:08:41 +0000 (16:08 +0100)] 
libmount: keep MS_PROPAGATION flags in mnt_context_set_mflags() result

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: write success messages to stdout
Karel Zak [Tue, 15 Jan 2013 14:53:46 +0000 (15:53 +0100)] 
mount: write success messages to stdout

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agotests: add/improve mount shared-subtree tests
Karel Zak [Tue, 15 Jan 2013 13:25:23 +0000 (14:25 +0100)] 
tests: add/improve mount shared-subtree tests

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: support multiple MS_PROPAGATION flags in one mount(8) exec
Karel Zak [Tue, 15 Jan 2013 13:23:54 +0000 (14:23 +0100)] 
mount: support multiple MS_PROPAGATION flags in one mount(8) exec

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: allow to use propagation flags in fstab
Karel Zak [Tue, 15 Jan 2013 12:55:29 +0000 (13:55 +0100)] 
libmount: allow to use propagation flags in fstab

Linux kernel does not allow to change more than one propagation flag
by one mount(2) syscall. The flags also cannot be mixed with another
mount options. It means that the propagation flags cannot be stored in
/etc/fstab, manual "mount --make-* <mountpoint>" is always necessary
after successful mount. Painful...

This patch implements additional mount(2) after previous successful
mount(2) (or exec /sbin/mount.<type>).

For example:

  mount /dev/sda1 /A -o private,unbindable,ro

or fstab entry:

  /dev/sda1   /A  auto  ro,private,unbindable

is implemented by three mount(2) calls:

- 1st mounts /dev/sda1 with MS_RDONLY
- 2nd sets MS_PRIVATE flag
        - 3rd sets MS_UNBINDABLE flag.

It's the same as as to manually call:

  mount /dev/sda1 /A -o ro
  mount --make-private /A
  mount --make-unbindable /A

This solution is not atomic, and umount(2) is not called if
propagation flags are not successfully applied, only error is
returned.

This change does not affect libmount API, so one beautiful day when
mount(2) syscall will be improved we can drop this nasty patch.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agokill: add note about threads to the man page
Karel Zak [Tue, 15 Jan 2013 10:14:03 +0000 (11:14 +0100)] 
kill: add note about threads to the man page

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=846790
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofindmnt: make --target usable with bind mounts
Karel Zak [Mon, 14 Jan 2013 13:50:50 +0000 (14:50 +0100)] 
findmnt: make --target usable with bind mounts

The --target <non-mount-point> functionality should be enabled only if
previous regular search found nothing to avoid collisions with bind
mounts, because to detect mountpoint we use traditional child / parent
stat.st_dev comparison which does not work for bind mounts (--bind /A
/A).

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofindmnt: add PROPAGATION column
Karel Zak [Thu, 10 Jan 2013 14:59:16 +0000 (15:59 +0100)] 
findmnt: add PROPAGATION column

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: add mnt_fs_get_propagation()
Karel Zak [Thu, 10 Jan 2013 14:58:52 +0000 (15:58 +0100)] 
libmount: add mnt_fs_get_propagation()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofindmnt: add ID column
Karel Zak [Thu, 10 Jan 2013 13:59:39 +0000 (14:59 +0100)] 
findmnt: add ID column

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofindmnt: add OPT-FIELDS column
Karel Zak [Thu, 10 Jan 2013 13:58:05 +0000 (14:58 +0100)] 
findmnt: add OPT-FIELDS column

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: read optional mountinfo fields
Ondrej Oprala [Thu, 10 Jan 2013 11:35:08 +0000 (12:35 +0100)] 
libmount: read optional mountinfo fields

[kzak@redhat.com: - rename struct member and functions from
                    "propagation" to "optional fields"
                  - split the original patch
                  - fix parser]

Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: fix regression test helper
Ondrej Oprala [Thu, 10 Jan 2013 11:07:29 +0000 (12:07 +0100)] 
libmount: fix regression test helper

Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: make btrfs magics more readable
Karel Zak [Thu, 10 Jan 2013 10:40:21 +0000 (11:40 +0100)] 
libblkid: make btrfs magics more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: cleanup --enable-most-builds list
Sami Kerola [Wed, 9 Jan 2013 22:44:06 +0000 (22:44 +0000)] 
build-sys: cleanup --enable-most-builds list

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agobuild-sys: ignore chkdupexe
Sami Kerola [Wed, 9 Jan 2013 22:44:05 +0000 (22:44 +0000)] 
build-sys: ignore chkdupexe

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agobuild-sys: add files to distribution
Sami Kerola [Wed, 9 Jan 2013 22:44:04 +0000 (22:44 +0000)] 
build-sys: add files to distribution

To fix 'make distcheck' compilation.  The fdisks/Makemodule.am has one
new entry 'dos_part_types.h', the rest is about sorting the list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agolibblkid: add support for btrfs backup superblock
Goffredo Baroncelli [Wed, 9 Jan 2013 21:14:43 +0000 (22:14 +0100)] 
libblkid: add support for btrfs backup superblock

Btrfs has three superblock. The first one is placed at 64KB, the second one at
64MB, the third one at 256GB.

If the first superblock is valid except that the "magic field" is zeroed, btrfs
skips the check of the other superblocks.  If the first superblock is fully
invalid, btrfs checks for the other superblock.

So zeroing the first superblock "magic field" at the beginning seems that the
filesystem is wiped. But when the first superblock is overwritten (eg by
another filesystem), then the other two superblock may be considered valid, and
the filesystem may resurrect.

This patch allow to find and wipe the other btrfs superblocks signature.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agohexdump: do not segfault when iterating over an empty format string
Ondrej Oprala [Fri, 21 Dec 2012 12:04:04 +0000 (13:04 +0100)] 
hexdump: do not segfault when iterating over an empty format string

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
11 years agomount: add support for x-mount.mkdir[=<mode>] option
Ondrej Oprala [Fri, 21 Dec 2012 13:45:46 +0000 (14:45 +0100)] 
mount: add support for x-mount.mkdir[=<mode>] option

If the target directory (mountpoint) does not exist then mount(8) will create
it before mount.<type> is executed or mount(2) syscall is called.

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount; add recursive mkdir
Karel Zak [Wed, 9 Jan 2013 17:05:08 +0000 (18:05 +0100)] 
libmount; add recursive mkdir

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: document x-* options
Karel Zak [Wed, 9 Jan 2013 14:41:46 +0000 (15:41 +0100)] 
mount: document x-* options

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomount: Fix -t in listing mode when run as non-root
Richard Tollerton [Thu, 3 Jan 2013 06:05:34 +0000 (00:05 -0600)] 
mount: Fix -t in listing mode when run as non-root

Presently, libmount-mount completely prohibits the use of -t by non-root
users.  This breaks using -t in listing mode as a user, which represents
a regression against mount-deprecated, macosx and presumably *BSD.

This commit fixes the issue by deferring the mnt_context_is_restricted
check for -t until we know we're not in listing mode.

Signed-off-by: Rich Tollerton <rich.tollerton@ni.com>
11 years agomkfs.minix: fix compiler warning [-Wformat]
Karel Zak [Wed, 9 Jan 2013 13:44:59 +0000 (14:44 +0100)] 
mkfs.minix: fix compiler warning [-Wformat]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: add missing promise raid metadata locations
Phillip Susi [Wed, 2 Jan 2013 16:40:46 +0000 (11:40 -0500)] 
libblkid: add missing promise raid metadata locations

There are some additional locations where dmraid can find
and use pdc raid metadata that libblkid was not checking.

11 years agomount: document options for debugfs
Dave Reisner [Wed, 2 Jan 2013 14:11:10 +0000 (09:11 -0500)] 
mount: document options for debugfs

Since 3.4, debugfs allows uid, gid, and mode options.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
11 years agobuild-sys: invert flag for sulogin emergency mount
Dave Reisner [Sun, 30 Dec 2012 20:00:23 +0000 (15:00 -0500)] 
build-sys: invert flag for sulogin emergency mount

This should be disabled by default.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
11 years agolosetup: fix declarations [smatch scan]
Sami Kerola [Fri, 28 Dec 2012 21:23:43 +0000 (21:23 +0000)] 
losetup: fix declarations [smatch scan]

sys-utils/losetup.c:309:2: error: 'for' loop initial declarations are only allowed in C99 mode
sys-utils/losetup.c:374:2: error: 'for' loop initial declarations are only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoswapon: default to --show if nothing is requested
Sami Kerola [Fri, 28 Dec 2012 21:23:42 +0000 (21:23 +0000)] 
swapon: default to --show if nothing is requested

Proposed-by: Karel Zak <kzak@redhat.com>
References: http://www.spinics.net/lists/util-linux-ng/msg07301.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoipcs: fix spacing in summary output
Sami Kerola [Fri, 28 Dec 2012 21:23:41 +0000 (21:23 +0000)] 
ipcs: fix spacing in summary output

Change 56692a6 introduced spacing error to --summary printing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoscript: search shell from path, when necessary
Sami Kerola [Fri, 28 Dec 2012 21:23:40 +0000 (21:23 +0000)] 
script: search shell from path, when necessary

Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoflock: improve usage strings
Mike Frysinger [Wed, 26 Dec 2012 20:10:29 +0000 (15:10 -0500)] 
flock: improve usage strings

The current examples miss the best usage of all: specifying the command
and its arguments directly on the command line.  Add that to both the
program usage and the man page.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoinclude/ttyutils: add default chardata
Werner Fink [Tue, 8 Jan 2013 14:38:40 +0000 (15:38 +0100)] 
include/ttyutils: add default chardata

this one moves the init_chardata to include/ttyutils.h as well as to
lib/include/ttyutils.c.  Also the macros CTL/CTRL are fixed in
agetty.c and sulogin.c to use the XOR variant CTL.

[kzak@redhat.com: use macro rather than global variable for default
                  chardata]

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoinclude: cleanup copyright headers
Karel Zak [Tue, 8 Jan 2013 14:00:23 +0000 (15:00 +0100)] 
include: cleanup copyright headers

We use the code from include/ and lib/ on many places, so use public
domain if possible or LGPL for code copied from libs.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoinclude/bitopts: Use the operating system byteswapping functions
Karel Zak [Tue, 8 Jan 2013 13:07:48 +0000 (14:07 +0100)] 
include/bitopts: Use the operating system byteswapping functions

The swap macros are already in libc.

Co-Author: Cristian Rodríguez <crrodriguez@opensuse.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: print warning about insecure owner/permissions
Karel Zak [Tue, 8 Jan 2013 12:13:40 +0000 (13:13 +0100)] 
swapon: print warning about insecure owner/permissions

Let's make it more obvious if swap area is accessible for non-root
users. The old version prints the warning only if --verbose is
specified.

Reported-by: mp.lists@free.fr
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolsblk: Add write-same attribute to topology info
Milan Broz [Thu, 20 Dec 2012 11:42:23 +0000 (12:42 +0100)] 
lsblk: Add write-same attribute to topology info

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agounshare: support the switching of namespaces
Neil Horman [Fri, 28 Dec 2012 16:22:18 +0000 (11:22 -0500)] 
unshare: support the switching of namespaces

In addition to the unshare syscall, there exists the setns syscall, which
allows processes to migrate to the namepsaces of other processes.  Add this
functionality into the unshare command, as they operate in a fairly simmilar
fashion.

Note: There was discussion of adding a path based namespace argument to unshare
in the origional discussion thread, but I opted to leave that out as it didn't
seem to fit in nicely with the current argument pattern.  I figure we can always
add that in later if we need to

[kzak@redhat.com: - fix optional arguments
                  - do not call unshare if no flag specified
                  - use O_CLOEXEC
                  - codding style cleanup]

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoagetty: replace perms 660 to 620
Karel Zak [Wed, 2 Jan 2013 07:23:00 +0000 (08:23 +0100)] 
agetty: replace perms 660 to 620

 ... the default is root:tty 620

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agobuild-sys: remove consoles.h
Karel Zak [Thu, 27 Dec 2012 16:37:27 +0000 (17:37 +0100)] 
build-sys: remove consoles.h

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosulogin: don't use {de,con}structor attributes
Karel Zak [Sun, 23 Dec 2012 21:44:05 +0000 (22:44 +0100)] 
sulogin: don't use {de,con}structor attributes

We're not Russian roulette players, so don't use such ugly things at all..

Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosulogin: remove consoles.c from libcommon
Karel Zak [Sun, 23 Dec 2012 21:14:21 +0000 (22:14 +0100)] 
sulogin: remove consoles.c from libcommon

- move struct chardata to include/ttyutils.h
- move console.{h,c} to login-utils/sulogin-* (it's sulogin specific)
- fix sulogin and agetty includes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomkfs.minix: fsck:minix: fix compiler warnings
Karel Zak [Thu, 20 Dec 2012 19:01:35 +0000 (20:01 +0100)] 
mkfs.minix: fsck:minix: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agomkswap: fix compiler warnings
Karel Zak [Thu, 20 Dec 2012 19:00:11 +0000 (20:00 +0100)] 
mkswap: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolslocks: fix compiler warnings
Karel Zak [Thu, 20 Dec 2012 18:57:48 +0000 (19:57 +0100)] 
lslocks: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofdisk: (gpt) fix compiler warnings
Karel Zak [Thu, 20 Dec 2012 18:55:55 +0000 (19:55 +0100)] 
fdisk: (gpt) fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosetterm: fix compiler warning
Karel Zak [Thu, 20 Dec 2012 18:55:20 +0000 (19:55 +0100)] 
setterm: fix compiler warning

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoipcs: fix compiler warnings, use 64bit time
Karel Zak [Thu, 20 Dec 2012 18:52:16 +0000 (19:52 +0100)] 
ipcs: fix compiler warnings, use 64bit time

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agohwclock: fix compiler warning
Karel Zak [Thu, 20 Dec 2012 18:51:38 +0000 (19:51 +0100)] 
hwclock: fix compiler warning

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoipcs: make --human really sexy
Karel Zak [Wed, 19 Dec 2012 14:27:12 +0000 (15:27 +0100)] 
ipcs: make --human really sexy

Align the "size" columns to the right.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/ismounted: improve loopdev support
Karel Zak [Wed, 19 Dec 2012 13:34:01 +0000 (14:34 +0100)] 
lib/ismounted: improve loopdev support

... to make it usable for situations when the same backing
file is mapped to more loop devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: improve test_blkid_devno, fix compiler warning [-Wunused-result]
Karel Zak [Wed, 19 Dec 2012 11:56:39 +0000 (12:56 +0100)] 
libblkid: improve test_blkid_devno, fix compiler warning [-Wunused-result]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/ismounted: basic support for loop devices
Karel Zak [Wed, 19 Dec 2012 11:40:32 +0000 (12:40 +0100)] 
lib/ismounted: basic support for loop devices

 # losetup -a /dev/loop0
 /dev/loop0: [2053]:1048578 (/home/fs-images/filesystems/ext2.img)

 # findmnt /dev/loop0
 TARGET    SOURCE     FSTYPE OPTIONS
 /mnt/test /dev/loop0 ext3   rw,relatime,data=ordered

old version:

 ./test_ismounted /home/fs-images/filesystems/ext2.img
 not mounted

new version:

 ./test_ismounted /home/fs-images/filesystems/ext2.img
 mounted on /mnt/test

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolib/loopdev: fix loopdev_find_by_backing_file()
Karel Zak [Wed, 19 Dec 2012 11:40:19 +0000 (12:40 +0100)] 
lib/loopdev: fix loopdev_find_by_backing_file()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: add missing exit value to fsck.minix(8)
Sami Kerola [Sun, 16 Dec 2012 10:44:00 +0000 (10:44 +0000)] 
docs: add missing exit value to fsck.minix(8)

And remove references to manual pages which has not been part of commonly
used distributions for a while.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agominix: replace magic constants with macro names
Sami Kerola [Sun, 16 Dec 2012 10:43:59 +0000 (10:43 +0000)] 
minix: replace magic constants with macro names

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agominix: use off_t, size_t, etc appropriate types
Sami Kerola [Sun, 16 Dec 2012 10:43:58 +0000 (10:43 +0000)] 
minix: use off_t, size_t, etc appropriate types

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agominix: change types in header file
Sami Kerola [Sun, 16 Dec 2012 10:43:57 +0000 (10:43 +0000)] 
minix: change types in header file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agotunelp: deprecation: remove command from default build
Sami Kerola [Sun, 16 Dec 2012 10:43:56 +0000 (10:43 +0000)] 
tunelp: deprecation: remove command from default build

It is difficult to think think tunelp command being in use a lot.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agomore: remove unnecessary variable
Sami Kerola [Sun, 16 Dec 2012 10:43:55 +0000 (10:43 +0000)] 
more: remove unnecessary variable

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoisosize: inform if file does not look like iso file system
Sami Kerola [Sun, 16 Dec 2012 10:43:54 +0000 (10:43 +0000)] 
isosize: inform if file does not look like iso file system

$ isosize /dev/urandom
isosize: /dev/urandom: might not be iso file system
-67690643227260

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoisosize: fix usage() -h option print out
Sami Kerola [Sun, 16 Dec 2012 10:43:53 +0000 (10:43 +0000)] 
isosize: fix usage() -h option print out

Fixes usage() bug from commit 4eba43a7 which claimed sort option for
--help being -H.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoipcs: add --bytes size output option
Sami Kerola [Sun, 16 Dec 2012 10:43:52 +0000 (10:43 +0000)] 
ipcs: add --bytes size output option

This makes the command being a little closer standard compliant.  See
IEEE Std 1003.1 referral link below for more information.

References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoipcs: add --human readable size conversion option
Sami Kerola [Sun, 16 Dec 2012 10:43:51 +0000 (10:43 +0000)] 
ipcs: add --human readable size conversion option

Introduces new function ipc_print_size() which will call
size_to_human_string(), and handles the occasional '([k]bytes)' printing
if default size format is requested.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agoipcs: assist debugging
Sami Kerola [Sun, 16 Dec 2012 10:43:50 +0000 (10:43 +0000)] 
ipcs: assist debugging

One will be able to see enum symbols when debugging, which is not the
case when values are specified as define list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agodocs: swapon.8 option name fix
Sami Kerola [Sun, 16 Dec 2012 10:43:49 +0000 (10:43 +0000)] 
docs: swapon.8 option name fix

The commit 7ae8b469adda598fda28e4ea647d47905b43e172 added option --bytes,
not the initial proposal which was changed after maillist discussion.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
11 years agopartx: add update command
Phillip Susi [Fri, 14 Dec 2012 19:57:25 +0000 (14:57 -0500)] 
partx: add update command

Update the kernel partition table to match what is on disk.  Remove any
extra partitions and add any missing ones.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
11 years agosulogin: map NL to CR-NL on output in initial termios settings
Karel Zak [Wed, 19 Dec 2012 09:24:23 +0000 (10:24 +0100)] 
sulogin: map NL to CR-NL on output in initial termios settings

(See also 9c62a2326e6e39a5e759830b0b9d91696166fb45 agetty patch).

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosulogin: minor coding style changes
Karel Zak [Tue, 18 Dec 2012 15:03:02 +0000 (16:03 +0100)] 
sulogin: minor coding style changes

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agosulogin: add multi console feature from SysVinit sulogin
Werner Fink [Mon, 10 Dec 2012 12:27:11 +0000 (13:27 +0100)] 
sulogin: add multi console feature from SysVinit sulogin

Now after adding Conflicts=rescue.service to getty@.service and
serial-getty@.service and Conflicts=getty.target to rescue.target
all works with `systemctl rescue'.  Even adding init=/sbin/sulogin
to the kernels command line by using the `e' key in grub2 boot
menu works flawless.

This version is without the emergency code as I've this moved to
lib/console.c where it belongs to.

Signed-off-by: Werner Fink <werner@suse.de>
11 years agosulogin: mount temporary /dev and /proc if not found
Werner Fink [Mon, 10 Dec 2012 12:27:10 +0000 (13:27 +0100)] 
sulogin: mount temporary /dev and /proc if not found

This is very usefull if initrd can not loaded that is no /dev and no
/proc is found.  Also if the /etc/shadow and /etc/passwd is copied into
the initrd the sulogin can be used in initrd even before /dev and/or /proc
are mounted.

Signed-off-by: Werner Fink <werner@suse.de>
11 years agosulogin: use alarm function to indicate if a timeout occurs
Werner Fink [Fri, 7 Dec 2012 08:00:56 +0000 (09:00 +0100)] 
sulogin: use alarm function to indicate if a timeout occurs

A small change to use the alarm handler to indicate if a timeout occurs.

Signed-off-by: Werner Fink <werner@suse.de>
11 years agosulogin: make usleep() workaround work
Werner Fink [Fri, 7 Dec 2012 08:00:55 +0000 (09:00 +0100)] 
sulogin: make usleep() workaround work

Simply fix a compile problem found during debugging console.c

Signed-off-by: Werner Fink <werner@suse.de>
11 years agosulogin: use the linked lists from list.h for consoles list
Werner Fink [Tue, 18 Dec 2012 14:02:35 +0000 (15:02 +0100)] 
sulogin: use the linked lists from list.h for consoles list

with this the double linked list feature from util-linux is used
instead of the single linked list.

[kzak@redhat.com: use list_last_entry() and list INIT macros]

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoinclude/list: add list_last_entry()
Karel Zak [Tue, 18 Dec 2012 13:49:21 +0000 (14:49 +0100)] 
include/list: add list_last_entry()

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agofdisk: remove crappy bugs section from man page
Karel Zak [Mon, 17 Dec 2012 16:11:05 +0000 (17:11 +0100)] 
fdisk: remove crappy bugs section from man page

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoinclude/list: fix undefined behavior in list_entry() macro
Sami Liedes [Mon, 17 Dec 2012 15:22:35 +0000 (16:22 +0100)] 
include/list: fix undefined behavior in list_entry() macro

Update list_entry() macro, which is basically the same as the
container_of() macro in the kernel, to use offsetof() to fix undefined
behavior.

Caught using clang -fsanitize=undefined.

[kzak@redhat.com: port from e2fsprogs]

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: fix typo
Karel Zak [Fri, 14 Dec 2012 15:12:47 +0000 (16:12 +0100)] 
docs: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agodocs: update AUTHORS file
Karel Zak [Thu, 13 Dec 2012 12:51:57 +0000 (13:51 +0100)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: fix typos
Karel Zak [Wed, 12 Dec 2012 20:01:32 +0000 (21:01 +0100)] 
libmount: fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoblkid: fix double free [coverity scan]
Karel Zak [Wed, 12 Dec 2012 19:48:15 +0000 (20:48 +0100)] 
blkid: fix double free [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibmount: make mkstemp() more robust [coverity scan]
Karel Zak [Wed, 12 Dec 2012 12:32:52 +0000 (13:32 +0100)] 
libmount: make mkstemp() more robust [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: fix memmory leak [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:40:48 +0000 (12:40 +0100)] 
swapon: fix memmory leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolibblkid: check mkdir(/run/blkid) return code [coverity scan]
Karel Zak [Wed, 12 Dec 2012 11:27:05 +0000 (12:27 +0100)] 
libblkid: check mkdir(/run/blkid) return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoswapon: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:18:20 +0000 (12:18 +0100)] 
swapon: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agoprlimit: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:16:16 +0000 (12:16 +0100)] 
prlimit: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agolscpu: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:13:38 +0000 (12:13 +0100)] 
lscpu: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>
11 years agonamei: don't care about xasprintf() return code
Karel Zak [Wed, 12 Dec 2012 11:12:25 +0000 (12:12 +0100)] 
namei: don't care about xasprintf() return code

Signed-off-by: Karel Zak <kzak@redhat.com>