Commit Graph

2243 Commits

Author SHA1 Message Date
Davidlohr Bueso f0961db21f ul: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 15:17:10 +01:00
Karel Zak 2ebef8704d col: use err.h and EXIT_* macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-01 14:51:08 +01:00
Davidlohr Bueso 04faca4a13 col: use xalloc for memory allocation
Differentiate between malloc and realloc (not done so far) and get rid of local warn()

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 14:32:48 +01:00
Davidlohr Bueso b7159bd5c9 tailf: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 14:31:34 +01:00
Davidlohr Bueso 0d4e5f8e0d more: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 14:31:32 +01:00
Davidlohr Bueso f3a342a429 pg: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 14:03:08 +01:00
Karel Zak a21640baec mount: use utimensat(AT_FDCWD) rather than open()+futimens()
Thanks to Kay Sievers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-29 20:04:00 +02:00
Karel Zak 29e6ed5e8f docs: add note about agetty to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-29 17:51:35 +02:00
Karel Zak 5d757a9fde remove free() from atexit() callbacks
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-29 13:29:28 +02:00
Marek Polacek 98da1298ca chrt: Add noreturn attribute to show_usage() function
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-10-29 13:26:25 +02:00
Marek Polacek 50644ff4de use _exit() instead of exit() in sighandlers
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-10-29 13:26:25 +02:00
Karel Zak e98f4af950 agetty: fix -s option (baud rate setup)
The problem is pretty visible in strace output:

broken version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0
                                       ^^^
fixed version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0

Reported-by: Jon Masters <jcm@redhat.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=645640
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-26 23:31:57 +02:00
Karel Zak dd0bd943f9 fsck: add support for whole-disk locking (-l option)
This feature allows to call multiple independent fsck instances rather
than use only one "fsck -A" process.

The lock uses LOCK_EX flock(2). The lock request is ignored if the
whole-disk is non-rotating disk. The verbose mode (-V) provides
information about disk locking.

Note that "fsck -l" does not care if the device is stacked, for
example if you want to call "fsck -l /dev/md0" and "fsck -l /dev/md1"
then the underlying devices will not be locked. The traditional "fsck
-A" does not run in parallel for stacked devices.

Requested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-26 14:22:28 +02:00
Karel Zak e4d5b4b3b4 libmount: optimize blkid_devno_to_devname()
The brutal force /dev directory scanning should be used as a fallback
solution only. Currently, almost all systems use udev and we can read the
name from /sys/block/<maj>:<min> symlink.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-25 23:23:48 +02:00
Karel Zak a5fd3d685e swapon: add support for "nofail" fstab mount option
This option is already supported by mount(8) and fsck(8), there is no
reason to have any exception for swap devices. Note that the --ifexists
command line option applies to all swap devices, the "nofail" setting
is per device.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-25 14:03:16 +02:00
Karel Zak 973d9cf9c6 umount: umount -r segfault
umount(8) segfaults when update incomplete mtab file after remount to
read-only (-r). For example autofs does not store info about
mountpoint to /etc/mtab file.

	# mount /dev/sda1 /mnt/test
	# sed -i -e 's:/dev/sda1 .*::g' /etc/mtab
	# cd /mnt/test
	# umount -r /mnt/test
	umount: /mnt/test busy - remounted read-only
	Segmentation fault

The command "umount -r" should not care about /etc/mtab if the related
mtab entry does not exist.

Reported-by: Paul Crawford <psc@sat.dundee.ac.uk>
Addresses: https://bugs.launchpad.net/bugs/579858
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-25 12:26:28 +02:00
Karel Zak 6cfa971e1b lib: add test program to canonicalize.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-25 11:00:15 +02:00
Karel Zak 88dd06b875 mount: remove warning about FS detection from mount.1
The warning is from util-linux 2.7.1 (year 1996)... the filesystems
detection is pretty generic now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 17:24:41 +02:00
Karel Zak f331598afc man: add russian translation of ddate.1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 15:00:47 +02:00
Marek Polacek 0c3e520240 ctrlaltdel: use err() instead of fprintf() and exit()
[kzak@redhat.com: - remove unnecessary program name from err(),
                  - use program_invocation_short_name]

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 13:28:45 +02:00
Davidlohr Bueso 026ed2cedd look: fix conflict between locally defined err() and glibc's version
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-21 10:37:57 +02:00
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