Commit Graph

24 Commits

Author SHA1 Message Date
Karel Zak
3d4820f4d1 fsck: make fs->type usage more robust [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 17:28:46 +01:00
Karel Zak
e317419807 fsck: use FS blacklist for non-all mode too
Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-02 15:51:45 +01:00
Karel Zak
be060aa113 fsck: use <var> in usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 12:07:32 +02:00
Karel Zak
e6e060ec8f fsck: indent usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 10:31:08 +02:00
Benno Schulenberg
2576b83cf5 fsck: in usage() unmark type as optional for the -t option
Also fix "specity" typo, spell "filesystem" consistently as one word,
swap the wording of one phrase, and use some semicolons for clarity.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-16 10:16:24 +02:00
Benno Schulenberg
fcc058f4b3 fsck: use same word category in message, and add translators comment
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-02 14:13:44 +02:00
Karel Zak
ce75b60528 build-sys: fix 'make checkincludes' warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-28 13:21:00 +02:00
Josiah Worcester
d78104d14e fsck, checktty, flock: Use more portable includes.
Signed-off-by: Josiah Worcester <josiahw@gmail.com>
2011-06-14 13:58:37 +02:00
Sami Kerola
e0eadc0dc5 fsck: fix clang compiler warning
fsck.c:874:22: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
				errx(EXIT_USAGE, _(fs_type_syntax_error));
						 ^~~~~~~~~~~~~~~~~~~~~~~

The issue was introduced in my commit 0a09eb4e, sorry.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-03-08 11:49:55 +01:00
Karel Zak
f1c2eaac53 fsck: fix -C parsing
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17 11:56:51 +01:00
Sami Kerola
0a09eb4efc fsck: use xmalloc, warn & err and new usage
All compler errors reported by -Wall -Wextra -pedantic are fixed.

The patch also makes fsck to use xalloc instead of it's own malloc.
That will make fsck to exit, which could be good thing, at sections
where it previously did not.

Almost all print outs where touched, where various printfs where
converted to warn or err messages.

Finally theres a fix to counter wrap bug that could (very unlikely)
manifest itself if an user specifies same flag exactly UINT_MAX times.

[kzak@redhat.com: - coding style
                  - define XALLOC_EXIT_CODE
                  - use verbose++ in main()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16 15:20:11 +01:00
Karel Zak
93bd18bc84 fsck: include c.h, fallback for PATH_MAX
Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-07 16:20:04 +01:00
Karel Zak
6c6f2af9e3 fsck: returns proper code on exec() error
# fsck -t foo /dev/sda1; echo $?
	fsck: fsck.foo: not found
	/sbin/fsck: Error 2 while executing fsck.foo for /dev/sda1
	0

new version:

	# fsck -t foo /dev/sda1; echo $?
	fsck: fsck.foo: not found
	fsck: Error 2 while executing fsck.foo for /dev/sda1
	8

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=619139
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-27 22:31:36 +01: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
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
Karel Zak
0c0f93fcc3 fsck: improve whole-disk check, detect stacked devices
The current heuristic for conversion from partition to whole-disk
is based on device names. It's pretty poor. This patch replaces this
code with blkid_devno_to_wholedisk(). This solution is based on
/sys FS and it works for arbitrary partitioned devices.

The another problem is the way how fsck determines stacked devices.
The current code checks device name for "md" prefix only. It does not
care about DM, dm-ccypt, and so on. This patch uses
/sys/block/.../slaves/, but it does not fully resolves dependencies
between all devices. The method is simple -- fsck does not check
stacked devices in parallel with any other device.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-08-19 15:33:45 +02:00
Karel Zak
a4a1da09cd build-sys: remove duplicate #includes
$ make checkincludes
fsck/fsck.c: errno.h is included more than once.
lib/canonicalize.c: string.h is included more than once.
shlibs/blkid/src/blkidP.h: stdio.h is included more than once.
shlibs/blkid/src/devname.c: string.h is included more than once.
shlibs/blkid/src/devno.c: string.h is included more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 10:21:05 +01:00
Mike Frysinger
bb4cb69df2 fsck/mkfs/mount: unify default search paths for helpers
Rather than each fs util having its own search policy, unify the paths in
configure and allow them to be tweaked by downstream.  In the process,
drop the /etc paths as no one has ever really used these.

[kzak@redhat.com: - backport to autoconf < 2.64
                    (remove AS_{SET,IF,CASE,APPEND} macros)]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-02 14:37:32 +01:00
Ludwig Nussel
1bb516c34b fsck: honor nofail option in fsck
analog to mount gracefully ignoring non existing devices if the "nofail"
option is specified in fstab, also have fsck -A skip them. This way it's
possible to have devices optionally not available during boot but still
have them fsck'd if they are there.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
2009-12-01 12:15:10 +01:00
Karel Zak
7009077bd2 fsck: remove useless if-before-free tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-24 16:40:52 +01:00
Karel Zak
fc3ea49e74 fsck: remove \007 from warning message
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-20 13:18:28 +01:00
Karel Zak
fb429f2219 fsck: cosmetic changes (NLS, paths, ...)
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:34:51 +01:00
Karel Zak
06cb26d93c fsck: link with generic fsprobe wrapper
This is a way how link fsck with libblkid (e2sprogs or util-linxu-ng
version) and libvolume_id.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:25:50 +01:00
Karel Zak
607c2a7295 fsck: move fsck from e2fsprogs to util-linux-ng
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18 15:09:34 +01:00