Commit Graph

2222 Commits

Author SHA1 Message Date
Davidlohr Bueso 87f3feac71 misc-utils: use new xmalloc() wrapper
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-10-21 10:31:50 +02:00
Davidlohr Bueso d7df7ba264 xalloc: general purpose memory allocation handling wrappers
[kzak@redhat.com: - use %zu for size_t]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 10:28:05 +02:00
Igor Bazhitov 784cb716b1 libblkid: fix memory leak
search_type and search_handle fields of blkid_dev_iterate iterator are
not being freed after usage.
Add cleanup code.

Signed-off-by: Igor Bazhitov <igor.bazhitov@gmail.com>
2010-10-21 09:45:05 +02:00
Sami Kerola 1ae90932bd column: code readability improvements
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2010-10-21 09:41:38 +02:00
Sami Kerola bf90b8a6af column: error messaging & exit codes
Human understandable error messages along with symbolic exit
codes to comply with coding standard.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2010-10-21 09:41:38 +02:00
Sami Kerola 80fa094c90 column: EOF handling bug
For the last line of the file lenght of line should be determined
where the EOF is instead of new line. Old output was

$ printf "1 2\n3" | column -t
column: line too long
1 2

which this commit will change to

$ printf "1 2\n3" | column -t
1  2
3

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 09:38:17 +02:00
Karel Zak 973af80642 libblkid: fix MBR detection on iPod and cleanup vfat code
- move all FAT code to superblocks/vfat.c only
 - add a generic function to verify FAT superblock and use it
   in FAT prober as well as in MBR parser
 - add a more robust FAT cluster_count check
   (it seems that iPod contains an "almost valid" FAT superblock before MBR)

Reported-by: Davidlohr Bueso <dave.bueso@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-15 01:33:28 +02:00
Karel Zak c76e710bc7 libblkid: consolidate magic strings detection code
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-15 01:32:13 +02:00
Davidlohr Bueso 4f1509b969 partx: integrate support for mac and sun partitions, based on kpartx.
[kzak@redhat.com: - remove unnecessary members from struct slice,
                  - fix gcc warnings]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-08 10:56:28 +02:00
Davidlohr Bueso aadd32ea8e partx: add sun partition table support
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-10-08 10:07:35 +02:00
Davidlohr Bueso 655945f7bf partx: add mac partition table support
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-10-08 10:07:26 +02:00
Karel Zak 28fed5d6ec docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 17:57:35 +02:00
Miklos Szeredi 1cf4c20b19 mount: don't canonicalize "spec" with --no-canonicalize option
"Spec" was still canonicalized despite --no-canonicalize.  This
resulted in a hang during login with pam_encfs (Debian Bug#593336).

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
2010-10-07 16:31:29 +02:00
Karel Zak a2cb313c02 tests: update namei regression test
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 10:37:03 +02:00
Karel Zak 37d6897f94 cal: use EXIT_* and program_invocation_short_name
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 10:35:32 +02:00
Petr Uzel fe81c7d1b8 lscpu: really use 'mode' argument in path_fopen() 2010-10-07 10:24:57 +02:00
Jakob Unterwurzacher c348d9346a flock: use more useful example in flock.1
The example in the man page does not prevent concurrent execution, as it
obtains a shared lock. More useful is taking an exclusive lock, i.e.
remove "-s".
Additionally, IMO most people want the script to exit when the lock
cannot be acquired, so adding "-n".
2010-10-07 10:24:28 +02:00
Milan Broz 7bbbf65045 findmnt: fix support for -a option
Signed-off-by: Milan Broz <mbroz@redhat.com>
2010-10-07 10:23:29 +02:00
Forest Bond 628e30197e sfdisk: save errno before calling perror
errno is saved into a local variable to avoid it getting trampled
by perror before it is checked to determine the return value.

This issue seems quite rare, but I have seen it when running sfdisk
via gksudo and using the --quiet command-line option.  From what I
can tell, this combination triggers loading of translations in perror,
which (at least on my machine) ends up changing the value of errno.

Signed-off-by: Forest Bond <forest@alittletooquiet.net>
2010-10-07 10:22:02 +02:00
Sami Kerola 6cebde5c96 column: update manual page to match column switches
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 10:20:31 +02:00
Sami Kerola a4cc8dfe7d column: getopt_long and new help output
[kzak@redhat.com: - remove __progname, cleanup usage()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 10:12:34 +02:00
Mike Frysinger fac8b4bd78 fallocate: fix build failure with old linux headers
If linux/falloc.h does not exist, the build system still enables the
fallocate util, but ultimately fails when it tries to include the
header and use a define from it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-07 09:49:01 +02:00
Karel Zak 236acf2d27 fsck: inform about nonexistent devices in verbose mode
Reported-by: Serafeim Zanikolas <sez@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 09:26:37 +02:00
Jeroen Oortwijn 305342f8c5 libblkid: add searching in attributes dir to BeFS
Add searching for the be:volume_id attribute in the attributes directory
of the root directory. UUID is now always set when the root directory
contains the be:volume_id attribute.

Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
2010-10-07 09:05:48 +02:00
Karel Zak 306c1df2f7 swapon: warn if file owner is not root
Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 09:03:31 +02:00
Karel Zak eac8c7dac9 umount: use strtosize() for offset=
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-07 08:58:00 +02:00
Sami Kerola c49e31f4ee namei: parse all path arguments when an optarg path will fail
Old implementation of namei listed path all the way to non-existing
file or directory, something like:

f: /usr/bin/nxdir/file
 d /
 d usr
 d bin
 ? nxdir - No such file or directory (2)

whiles the current implementation prints:

namei: failed to stat: /usr/bin/nxdir/file: No such file or directory

The new output it's not helpful. I am especially interested see where
the path is broken when a path is symlink to other path with symlink,
and few more like that, and something somewhere is broken.

[kzak@redhat.com: - coding style changes]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-01 00:36:45 +02:00
Karel Zak 2429509658 taskset: proper numbers parsing
Reported-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-30 23:29:14 +02:00
Markus Rinne 263644840f fdisk: eliminate redundant call to open()
Don't use open() in get_boot() if it's called with an argument try_only,
because the file has already been opened by the caller.

Signed-off-by: Markus Rinne <markus.ka.rinne@gmail.com>
2010-09-30 22:52:42 +02:00
Sven Eckelmann d4ac6657c5 mount: Don't call canonicalize_*(SPEC) for 9p
When calling "mount -t 9p -o trans=virtio foobar /mnt/bar" and foobar
exists in the current path, the 9p virtio transport driver will be
called with $CWD/foobar and fail with "9p: no channels available".

Similar problems exist with remote file servers
 "mount -t 9p 23.42.08.15 /mnt/bar"
and Plan 9 From User Space applications
 "mount -t 9p -o trans=unix,uname=$USER `namespace`/acme /mnt/bar"

A similar exception like for nfs, cifs and smbfs must be added for 9p.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
2010-09-30 22:32:50 +02:00
Chris Frost 320e5b73a2 mount: avoid starting a man page line with a single quote
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-30 22:32:25 +02:00
Petr Uzel b25dcfca92 mount: fix mount.8, shortname=mixed is now default for vfat
Since Linux kernel commit 955234755ce4a2c33cfc558912aa8f2148cc1fc6,
the default mode for vfat filesystem is 'shortname=mixed'.

Reported-by: Harald Koenig <koenig@linux.de>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2010-09-30 22:31:14 +02:00
Karel Zak a8e7dd2a1a ddate: revert man page typo
On Sat, Sep 18, 2010 at 03:10:52AM +0300, Anssi Hannula wrote:
> According to wikipedia [1] 'Holyday' was the correct spelling, I
> guess the first hunk should be reverted.
>
> [1] http://en.wikipedia.org/wiki/Discordian_calendar

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-30 22:27:42 +02:00
Karel Zak 1b85dcd9ca mount: rewrite is_readonly()
This new implementation is more optimistic and always calls access(2).
The fallback solution (modify atime by futimens(2)) should be used
very rarely.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-20 14:37:24 +02:00
Karel Zak 59f8c787e7 ul: use atexit() to deallocate buffer, print errors by err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-17 10:35:35 +02:00
Davidlohr Bueso 4727b16944 ul: fix memory leak.
The 'obuf' variable is not being freed after usage and this includes
when SIGINTs occur, hence add some basic signal handling.

[kzak@redhat.com - remove if-before-free ]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-17 10:02:36 +02:00
Davidlohr Bueso ad0ad79ae9 lscpu: update lscpu.1 to include new additions.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-09-17 10:00:41 +02:00
Davidlohr Bueso e0c2b50ae2 ddate: fix typo in ddate.1
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-09-17 10:00:35 +02:00
Karel Zak 4566208f95 mount: add note about context= remount to mount.8
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-17 00:09:38 +02:00
Karel Zak 26eb5a59fc libblkid: don't probe directories
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-15 11:51:09 +02:00
Karel Zak 7c97f7402e mount: better describe UUIDs usage in man pages
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=632373
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-13 11:43:14 +02:00
Karel Zak 23489c2625 libblkid: don't ignore zero for SBMAGIC_OFFSET
The side effect of this bug is that wipefs(8) does not report LUKS...

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-07 11:30:50 +02:00
Karel Zak 74089287cf docs: add blkid --list-all to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-07 11:03:45 +02:00
Karel Zak 73356e0553 cfdisk: don't use size of device based on cylinders
This patch is enough to make cfdisk usable on non-DOS disks where
partitioning is not based on CHS. cfdisk should not print error
messages for such disks.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=630340
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-09-06 13:30:48 +02:00
Karel Zak 9a30c6ef92 findmnt: don't swap source and target if the source is a tag
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-31 12:24:00 +02:00
Karel Zak abe3d704b6 mount: clean up fstab.5
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-30 11:43:41 +02:00
Karel Zak e31597d8ed mount: add note about subtypes to fstab.5
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-30 11:40:43 +02:00
Karel Zak 8f83100949 blockdev: fix typo in blockdev.8
Reported-by: Marcos Felipe Rasia de Mello <marcosfrm@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-28 00:50:24 +02:00
Karel Zak 8eff6643e1 mount: add info about type.subtype to /sbin/mount.<type> API description
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-27 20:42:43 +02:00
Miklos Szeredi dc0a335554 mount: handle filesystems with subtype
Linux can handle filesystem types with "MAINTYPE.SUBTYPE" format,
where the main type determines the actual filesystem driver while the
subtype can be interpreted by the filesystem itself.

When searching for mount helpers mount(8) and umount(8) should also
interpret such types, falling back to (u)mount.MAINTYPE if
(u)mount.MAINTYPE.SUBTYPE doesn't exist.

This patch implements this, passing the type with "-t TYPE"
to the mount program in this case.

Reported-by: Josef Bacik <josef@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=625064
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
2010-08-27 20:23:19 +02:00